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

All Samples(4)  |  Call(2)  |  Derive(0)  |  Import(2)
Cachable entry.  Used as a wrapper around real values stored in cache.
value
expires_at
cache_hits
calculation_time
TODO: Based on above data we can have a different invalidation policy

src/e/r/erp5-HEAD/product/ERP5Type/CachePlugins/RamCache.py   erp5(Download)
 
import time
from BaseCache import BaseCache, CacheEntry
from Products.ERP5Type import interfaces
import zope.interface
  def set(self, cache_id, scope, value, cache_duration=None, calculation_time=0):
    cache = self.getCacheStorage()
    cache[(scope, cache_id)] = CacheEntry(value, cache_duration, calculation_time)
    self.markCacheMiss()
 

src/e/r/erp5-HEAD/product/ERP5Type/CachePlugins/DistributedRamCache.py   erp5(Download)
from zLOG import LOG, WARNING
from BaseCache import BaseCache
from BaseCache import CacheEntry
from Products.ERP5Type import interfaces
import zope.interface
  def set(self, cache_id, scope, value, cache_duration=None, calculation_time=0):
    cache_storage = self.getCacheStorage()
    cache_id = self._getCacheId(cache_id, scope)
    cache_entry = CacheEntry(value, cache_duration, calculation_time)
    cache_storage.set(cache_id, cache_entry)