This Python module offers convenient decorators and utilities for "python-memcached".
Getting started with memorised is a breeze. You can choose to install memorised via the supplied setup.py or via easy_install. From there, it's time to start using it!
To cache a simple unbound function, simply include the "@memorise()" tag within the function definition. Note that the parentheses are necessary, as the decorator needs to be initialised at the time of binding to handle "memorise" specific arguments. On the other hand, if you want to apply caching to instance and class methods, you may need to include some form of identity to single out a method call on one instance from another. This can be accomplished by providing a list of one or more "parent keys," which are the names of attributes in the parent instance that you want to be appended to the memcache key.
If you need to keep attributes in line with the value retrieved from memcache- especially if those attributes are pickled or accessed directly by other code- just pass the name of the attribute to update as a string via the "set" argument.
Using memorised for your caching needs gives you the option of a dependency injection for the Python-memcached Client instance by passing in the "mc" argument. Alternatively, you can pass in a list of memcache servers via the "mc_servers" argument.
If you're looking for other usage examples, be sure to check out the unittests in "tests.py". Do keep in mind that if you don't have memcache running at localhost:11211, you'll need to either start it or modify the test suite to use a different memcache Client configuration- otherwise, all the tests will fail.
Version 1.0.2: N/A