Skip to content

Commit

Permalink
docs docs docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jneen committed Apr 5, 2012
1 parent 249c39e commit 5e0ebf8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ some_expensive_method.cached(default=3)
Options can be passed to either the `Cache` constructor or the decorator. Options passed to the decorator take precedence. Available options are:

enabled If `False`, the backend cache will not be used at all,
and your functions will be run as-is. This is useful
for development, when the backend cache may not be
present at all.
and your functions will be run as-is, even when you call
`.cached()`. This is useful for development, when the
function may be changing rapidly.
Default: True

bust If `True`, the values in the backend cache will be
Expand All @@ -54,6 +54,12 @@ def expensive_method():
# ...
```

## Local Caches

Cache provides two "fake" caches for local development without a backend cache: `LocalCache` and `NullCache`. `LocalCache` uses a dictionary in place of a backend cache, and `NullCache` is a noop on `set` and always returns `None` on `get`.

The difference between passing `enabled=False` to the cache and using `NullCache` comes in when you use the `.cached()` method. If the cache is disabled, `.cached()` will run the underlying function, but `NullCache` will throw a `KeyError` as if the key was not present.

### P.S.

If you're a Ruby user, check out the analogous [Cacher][] library for Ruby
Expand Down
6 changes: 3 additions & 3 deletions src/cache/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ class Cache:
Keyword Arguments:
enabled If `False`, the backend cache will not be used at all,
and your functions will be run as-is. This is useful
for development, when the backend cache may not be
present at all.
and your functions will be run as-is, even when you call
`.cached()`. This is useful for development, when the
function may be changing rapidly.
Default: True
bust If `True`, the values in the backend cache will be
Expand Down

0 comments on commit 5e0ebf8

Please sign in to comment.