Skip to main content

memorised

About

memorised is a python module containing handy python-memcached decorators and utils. Specifically the memorise decorator allows you to quickly and simply add memcache caching to any function or method.

Installation

Install memorised using pip:

pip install memorised

Or using the supplied setup.py:

python setup.py install

Usage

To cache a simple unbound function, just include the @memorise() tag to the function definition (the paranthesis are needed as the decorator needs to be initialised at the time of binding to handle memorise specific arguements):

from memorised.decorators import memorise

@memorise()
def myfunction():
    return 'hello world'

You can do the same for simple instance and class methods, however for most instance methods, e.g. when caching results for database models, you probably want to include some form of identity to single out a method call on one instance from another instance. You can do this by providing a list of one ore more parent keys, these are the names of attributes in the parent instance that you want to be appended to the memcache key:

class MyModel:
    id = 1

    @memorise(parent_keys=['id'])
    def get_stats():
        return blah()

For other usage examples see the unittests in tests.py.

Metadata

Release files for memorised 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for memorised 1.1.0
File Size Uploaded Provenance Actions
memorised-1.1.0.tar.gz 5.7 kB Without provenance Details for memorised-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for memorised 1.1.0
File Interpreter ABI Platform Actions
memorised-1.1.0.linux-x86_64.tar.gz Details for memorised-1.1.0.linux-x86_64.tar.gz

Total release size: 15.6 kB

Release files / memorised-1.1.0.tar.gz

Download URL memorised-1.1.0.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a2cb90e04e614a7002f6948d9e54fa3641d2dc5fa70391c128d0df361cc03ce8
BLAKE2b-256 checksum
How to use checksums
c9763befd53117486bedc3ef92bb451a58cf893596254623e33827600c77ddaf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / memorised-1.1.0.linux-x86_64.tar.gz

Download URL memorised-1.1.0.linux-x86_64.tar.gz
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a1f41121b61214003829f60742c6c1a692aa2267669cdff00378add2a616cfc4
BLAKE2b-256 checksum
How to use checksums
78f51ee3b726bfb31b4037146fe27cffd5b0d66e2df5a0732a63cf53f9023902
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for memorised 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files No provenance

1.0.2

1.0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page