pyxmpp.cache.CacheItem

Package pyxmpp :: Module cache :: Class CacheItem |
[hide private]

# Class CacheItem

source code

    object --+
             |
            CacheItem

An item in a cache.

Instance Methods | [hide private]
__init__(self, address, value, freshness_period, expiration_period, purge_period, state=`'``new``'`) Initialize an CacheItem object. | source code
datetime |
update_state(self) Update current status of the item and compute time of the next state change. | source code
__cmp__(self, other) | source code
Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Instance Variables | [hide private]
: `threading.RLock` | _lock : lock for thread safety.
: any hashable | address : item address.
: datetime | expire_time : time when the object expires.
: datetime | freshness_time : time when the object stops being fresh.
: datetime | purge_time : time when the object should be purged.
: `str` | state : current state.
: `int` | state_value : numerical value of the current state (lower number means fresher item).
: datetime | timestamp : time when the object was created.
: `instance` | value : item value (cached object).

Properties | [hide private]
Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, address, value, freshness_period, expiration_period, purge_period, state=`'``new``'`) (Constructor) | source code
Initialize an CacheItem object. Parameters: `address` (: any hashable) - : item address. `value` (: `instance`) - : item value (cached object). `freshness_period` (: timedelta) - : time interval after which the object stops being fresh. `expiration_period` (: timedelta) - : time interval after which the object expires. `purge_period` (: timedelta) - : time interval after which the object should be purged. When 0 then item will never be automaticaly purged. `state` (: `str`) - : initial state. Overrides: object.__init__

### update_state(self) | source code
Update current status of the item and compute time of the next state change. Returns: datetime the new state.

Instance Variable Details | [hide private]

### purge_time : time when the object should be purged. When 0 then item will never be automaticaly purged.