django模型的易于使用的缓存。
django-model-cache的Python项目详细描述
#django model cache
django models的一个易于使用的缓存。
此代码已经开发并在生产环境中使用了一年。
有关更多示例,请参见“tests/simple/tests.py”。
``python
class brand(models.model):
name=models.charfield(max_length=128)
class product(models.model):
code=models.uuidfield(default=uuid.uuid4,editable=false,unique=true)
brand=models.foreignkey('brand')
name=models.charfield(最大长度=255)
cache=cachecontroller(fields=['code',('brand戥id','name')],related戥fields=['brand',timeout=none)
class meta:
unique戥together=('name',,'br and')
product=product.cache.get(pk=1)
\product=product.cache.get(pk=1)
只需运行“tox-tox”就可以了。
'或安装依赖项并运行'cd tests/&;./manage.py测试`.
django models的一个易于使用的缓存。
此代码已经开发并在生产环境中使用了一年。
有关更多示例,请参见“tests/simple/tests.py”。
``python
class brand(models.model):
name=models.charfield(max_length=128)
class product(models.model):
code=models.uuidfield(default=uuid.uuid4,editable=false,unique=true)
brand=models.foreignkey('brand')
name=models.charfield(最大长度=255)
cache=cachecontroller(fields=['code',('brand戥id','name')],related戥fields=['brand',timeout=none)
class meta:
unique戥together=('name',,'br and')
product=product.cache.get(pk=1)
\product=product.cache.get(pk=1)
只需运行“tox-tox”就可以了。
'或安装依赖项并运行'cd tests/&;./manage.py测试`.