Skip to content

Automatic caching and caching invalidation for callables.

License

Notifications You must be signed in to change notification settings

filwaitman/pysmartcache

Repository files navigation

Travis Codecov PyPI License Python versions PyPI downloads per month

pysmartcache

PySmartCache is a memoizer implementation with lasers.

Idea is quite simple: you just need to decorate your function/method with @cache(), and pysmartcache will take care of the rest (caching based on arguments, cache invalidation, helpers for cache purge, cache refresh and cache invalidation, and so on).

For instance, change this:

def calculate_universe_mass(some_parameter, another_parameter, whatever):
    return 42

to this:

from pysmartcache import cache
@cache()
def calculate_universe_mass(some_parameter, another_parameter, whatever):
    return 42

Seriously. That's it. =P

For more dense details please refer to the docs.

Development:

Run linter:

pip install -r requirements_dev.txt
isort -rc .
tox -e lint

Run tests via tox:

pip install -r requirements_dev.txt
tox

Release a new major/minor/patch version:

pip install -r requirements_dev.txt
bump2version <PART>  # <PART> can be either 'patch' or 'minor' or 'major'

Upload to PyPI:

pip install -r requirements_dev.txt
python setup.py sdist bdist_wheel
python -m twine upload dist/*

Contributing:

Please open issues if you see one, or create a pull request when possible. In case of a pull request, please consider the following:

  • Respect the line length (132 characters)
  • Write automated tests
  • Run tox locally so you can see if everything is green (including linter and other python versions)

About

Automatic caching and caching invalidation for callables.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages