Files
catalyst/zipline/utils
Eddie Hebert 76e14eda2f ENH: Add expiring cache.
Add a cache interface which supports expirable entries with a changeable
backend for the cache into which they are entered.

The default cache is a `dict` but could swapped for
`cachetools.LRUCache` or any other cache which supports `__get__`,
`__set__`, and `__del__`.

So that consumers can change the use of `CachedObjects` stored in a
cache from:

```
self._cache = {}

...

try:
    obj = self._cache[key]
    try:
        return obj.unwrap(dt)
    except Expired:
        pass
except KeyError:
    pass

...

self._cache[key] = CachedObject(value, new_expiration)
```

to:

```
self._cache = ExpiringCache(LRUCache(maxsize=6))

...

try:
    return self._cache.get(key, dt)
except KeyError:
    # Get fresh value
    ...

    self._cache.set(key, value, new_expiration)
```
2016-04-14 16:10:32 -04:00
..
2015-10-01 18:03:53 -04:00
2015-03-19 17:21:25 -04:00
2016-04-14 16:10:32 -04:00
2015-11-11 14:19:13 -05:00
2014-03-26 20:46:20 +09:00
2016-02-04 21:58:57 -05:00
2016-02-24 14:50:32 -05:00
2015-12-01 10:48:20 -05:00
2015-11-24 16:55:07 -05:00