@_enable_thread_pool<EOL><INDENT>@_enable_lock<EOL>@_enable_cleanup<EOL>def get(self, key, timeout=<NUM_LIT:1>, is_async=False, only_read=True):<DEDENT>
if key not in self.cache_items:<EOL><INDENT>self.logger.debug('<STR_LIT>' % key)<EOL>return None<EOL><DEDENT>item = self.cache_items.pop(key)<EOL>item.update_hit_count()<EOL>if self.read_after_refresh_expire:<EOL><INDENT>item.refresh_expire(self.expire)<EOL><DEDENT>value = item[key]<EOL>self.cache_items[key] = item<EOL>self.total_access_count += <NUM_LIT:1><EOL>return value<EOL>
Test:

>>> import time
>>> cache = Cache(expire=2)
>>> cache.put(key='a', value=0)
>>> cache.put(key='b', value=1)
>>> cache.put(key='c',value= 2)
>>> cache.get('a')
0
>>> cache.get('b')
1
>>> cache.get('c')
2
>>> cache.get('e') == None
True
>>> time.sleep(2)
>>> cache.put(key='e', value=4)
>>> cache.get('a') == None
True
>>> cache.get('b') == None
True
>>> cache.get('c') == None
True