django函数和方法的简单缓存
django-elephant的Python项目详细描述
#Django大象
[![构建状态](https://travis ci.org/jairhenrique/django elephant.svg)(https://travis ci.org/jairhenrique/django elephant)
[![PYPI版本](https://badge.fury.io/py/django elephant.svg)(https://badge.fury.io/py/django elephant)
[![codecov.io](https://codecov.io/github/jairhenrique/django-elephant/coverage.svg?branch=master)(https://codecov.io/github/jairhenrique/django-elephant?分支=主)
[![代码问题](https://www.quantifiedcode.com/api/v1/project/03084631935244baa8335617d6502d11/badge.svg)(https://www.quantifiedcode.com/app/project/03084631935244baa8335617d6502d11)
*django elephant是缓存django方法或函数的响应的简单包装器*
django-elephant
```
## Usage
#### Basic:
```python
from elephant import memorize
@memorize()
def foo(bar):
return bar
```
#### Set cache configuration:
```python
from django.core.cache import caches
from elephant import memorize
other_cache = 缓存['other_cache']
@memmemory(
>cache=other_cache
def foo(bar):
returnbar
````
` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` py ` ` ` ` ` ` ` ` `:
返回条
````
密钥:
``来自大象导入的python
def my_custom_key(函数,*参数,**kwargs:
return{{}.{{}.{{}.format(
‘大象’函数。
函数名。
@memmemory(
cache-key=my自定义键
)
def foo(酒吧):
return bar
````
需求
-django>;=1.5
贡献
-分叉并发出拉动请求!
[![构建状态](https://travis ci.org/jairhenrique/django elephant.svg)(https://travis ci.org/jairhenrique/django elephant)
[![PYPI版本](https://badge.fury.io/py/django elephant.svg)(https://badge.fury.io/py/django elephant)
[![codecov.io](https://codecov.io/github/jairhenrique/django-elephant/coverage.svg?branch=master)(https://codecov.io/github/jairhenrique/django-elephant?分支=主)
[![代码问题](https://www.quantifiedcode.com/api/v1/project/03084631935244baa8335617d6502d11/badge.svg)(https://www.quantifiedcode.com/app/project/03084631935244baa8335617d6502d11)
*django elephant是缓存django方法或函数的响应的简单包装器*
django-elephant
```
## Usage
#### Basic:
```python
from elephant import memorize
@memorize()
def foo(bar):
return bar
```
#### Set cache configuration:
```python
from django.core.cache import caches
from elephant import memorize
other_cache = 缓存['other_cache']
@memmemory(
>cache=other_cache
def foo(bar):
returnbar
````
` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` py ` ` ` ` ` ` ` ` `:
返回条
````
密钥:
``来自大象导入的python
def my_custom_key(函数,*参数,**kwargs:
return{{}.{{}.{{}.format(
‘大象’函数。
函数名。
@memmemory(
cache-key=my自定义键
)
def foo(酒吧):
return bar
````
需求
-django>;=1.5
贡献
-分叉并发出拉动请求!