A suite of better cache tools for Django.
Project description
Full Documentation: http://readthedocs.org/docs/django-better-cache/en/latest/
Mailing List: https://groups.google.com/forum/#!forum/bettercache
## Better Cache
Better Cache is a replacement for the default cache template tag library from Django.
It is a better version of {% cache %}
What is better about Better Cache?
- Nested cache fragments inherit the variables their parent fragments key on
- Parent cache fragments can be given additional keys by their child cache fragments
An example:
{% cache 500 "outer" x %}
y = {{ y }}<br />
{% cache 500 "inner" y %}
x = {{ x }}<br />
{% endcache %}
{% endcache %}
In the default {% cache %} tag from Django, the inner fragment will not be
rerendered when x changes, because only the outer fragment uses that as a key
variable. The outer fragment will not update with y changes, because only the
inner fragment uses that.
With Better Cache, x and y affect both, so fragments will be re-rendered when
any important variable changes.
Better Cache also allows a syntax of giving defaults to key variables:
{% cache 500 "test" x=10 %}
### Controlling inheritence
You don't always want the outer cache fragments to invalidate when variables
only important to the inner fragment changes. In some cases, the inner fragment
is allowed to get stale if it stays cached longer as part of the parent, so
we want a way to disable the inheritence of the variables.
You can do this with the `local` modifier. All modifiers after the `local` will
affect only this cache fragment, not its parent.
{% cache 500 "outer" x %}
y = {{ y }}<br />
{% cache 500 "inner" local y %}
x = {{ x }}<br />
{% endcache %}
{% endcache %}
### Plans
- on-demand invalidation of fragments based on mappings through an ORM-like interface
Mailing List: https://groups.google.com/forum/#!forum/bettercache
## Better Cache
Better Cache is a replacement for the default cache template tag library from Django.
It is a better version of {% cache %}
What is better about Better Cache?
- Nested cache fragments inherit the variables their parent fragments key on
- Parent cache fragments can be given additional keys by their child cache fragments
An example:
{% cache 500 "outer" x %}
y = {{ y }}<br />
{% cache 500 "inner" y %}
x = {{ x }}<br />
{% endcache %}
{% endcache %}
In the default {% cache %} tag from Django, the inner fragment will not be
rerendered when x changes, because only the outer fragment uses that as a key
variable. The outer fragment will not update with y changes, because only the
inner fragment uses that.
With Better Cache, x and y affect both, so fragments will be re-rendered when
any important variable changes.
Better Cache also allows a syntax of giving defaults to key variables:
{% cache 500 "test" x=10 %}
### Controlling inheritence
You don't always want the outer cache fragments to invalidate when variables
only important to the inner fragment changes. In some cases, the inner fragment
is allowed to get stale if it stays cached longer as part of the parent, so
we want a way to disable the inheritence of the variables.
You can do this with the `local` modifier. All modifiers after the `local` will
affect only this cache fragment, not its parent.
{% cache 500 "outer" x %}
y = {{ y }}<br />
{% cache 500 "inner" local y %}
x = {{ x }}<br />
{% endcache %}
{% endcache %}
### Plans
- on-demand invalidation of fragments based on mappings through an ORM-like interface
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
bettercache-0.7.tar.gz
(22.8 kB
view details)
File details
Details for the file bettercache-0.7.tar.gz
.
File metadata
- Download URL: bettercache-0.7.tar.gz
- Upload date:
- Size: 22.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 66f5b8e562fcf6cb89a56adb2b2f792692c1b3e88e5771283c215e9085ba5182 |
|
MD5 | 0357f6e321d1d0e7428e54095ddd318f |
|
BLAKE2b-256 | e5601f3ae000118d9f215cb5889c3ada7631a386adcba6f7127f691e8597d4ee |