Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(4)  |  Call(3)  |  Derive(0)  |  Import(1)
An LRU cache with deferred (on-request) writing. When values put back into
the cache, they are flagged as dirty, but are not written to the backend
until ``.flush()`` is called. When the cache is flushed, all dirty values
will be written back. Note that ``.flush()`` must be called frequently
enough that the cache does not self-evict dirty values--this will fail.

This is NOT thread-safe.

src/m/a/manhattan-0.2/manhattan/backend/__init__.py   manhattan(Download)
 
from .rollups import AllRollup, LocalDayRollup, LocalWeekRollup, BrowserRollup
from .cache import DeferredLRUCache
from .model import VisitorHistory, Test, Goal
 
        self.store = store = SQLPersistentStore(sqlalchemy_url)
 
        self.visitors = DeferredLRUCache(get_backend=store.get_visitor_history,
                                         put_backend=store.put_visitor_history,
                                         max_size=cache_size)
        self.tests = DeferredLRUCache(get_backend=store.get_test,
                                      put_backend=store.put_test,
                                      max_size=cache_size)
        self.goals = DeferredLRUCache(get_backend=store.get_goal,