This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description
cache_it
====

__cache_it__ is a decorator which wraps caching(read/write) routine.
Decorated functions automatically access your memcache and get/set values depending on the situation.
All you have to do is decorate your function by __@cache_it__.


## Basic Usage

```python
>>> from cache_it import init_cache, cache_it

>>> init_cache(['127.0.0.1:11211'])

>>> @cache_it(prefix='PREFIX:')
>>> def cached_function(key):
>>> return 'value'

>>> cached_function('key')
'value' # cached => key:'PREFIX:key' value:'value'
>>> cached_function('key')
'value' # getting from a cache

```

## As a method
You can decorate not only functions but also methods in the same way.

```python
class User(Document)
@cache_it(prefix='PREFIX')
def __getitem__(self, key):
return user[key]

```

## ignore_exception (False by default)
If you want to ignore exceptions occured when accessing memcache, you have to set "ignore_exception" into True.

```python
@cache_it(prefix='PREFIX', ignore_exception=True)
def cached_function(key):
return 'value'

```


## ttl (24*60*60 sec by default)

```python
@cache_it(prefix='PREFIX', ttl=60) # 60sec
def cached_function(key):
return 'value'

```

## encoder/decoder
Encoders are called before setting a value.
Decoders, on the other hand, are called after getting a value.

```python
@cache_it(prefix='PREFIX',
encoder=lambda x: x['foo'],
decoder=lambda x: {'foo': x})
def cached_function(key):
return {'foo': 'bar'}


```
Release History

Release History

0.0.1

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
cache_it-0.0.1.macosx-10.9-intel.tar.gz (6.2 kB) Copy SHA256 Checksum SHA256 any Dumb Binary Jun 17, 2014
cache_it-0.0.1-py2.7.egg (8.1 kB) Copy SHA256 Checksum SHA256 2.7 Egg Jun 17, 2014
cache_it-0.0.1.tar.gz (4.0 kB) Copy SHA256 Checksum SHA256 Source Jun 17, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting