Skip to main content

A small decorator which helps cache a result of a function

Project description

Cache Function

You can use this python decorator Github-flavored Markdown to cache a result of a function.

Installation

pip install -i https://test.pypi.org/simple/ cache-function-deepakmishra

Usage

Production Setting

from cache_function import cache_function
cache_function.cache = **your cache object which has get and set functions**

Development Setting

from cache_function import cache_function, test_cache_function
cache_function.cache = test_cache_function.DummyCache()

Usage: Cache a function result

from cache_function.cache_function import cache_function

@cache_function(expiry=30) # time in seconds
def foo(a, b, c):
    return a + b + c

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cache-function-deepakmishra-0.0.3.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file cache-function-deepakmishra-0.0.3.tar.gz.

File metadata

  • Download URL: cache-function-deepakmishra-0.0.3.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.8

File hashes

Hashes for cache-function-deepakmishra-0.0.3.tar.gz
Algorithm Hash digest
SHA256 af1c73c13974081b26cdf8b15bd37612cb6c462b5d558d5c466274ca33807f03
MD5 adefee947402294d160e2e8becd7c3c5
BLAKE2b-256 4992eef19642972cbb5949b6a36476979985cf73adc00a02f4abf9712be5055a

See more details on using hashes here.

File details

Details for the file cache_function_deepakmishra-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: cache_function_deepakmishra-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.8

File hashes

Hashes for cache_function_deepakmishra-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d1fc4ee57940ad80bf77acab95f71b1d89065426e422efb52e48b9e4568259e7
MD5 e68014b646d80ec03c88857229cb3a02
BLAKE2b-256 390e719b82bde24fb85d683c123c44a3e4065d79a1d089f1505864517a7fdfd1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page