Class MemCache
- class ooodev.utils.cache.MemCache[source]
Memory Cache
- get(key)[source]
Get value by key.
- Parameters:
key (Any) – Any Hashable object.
- Returns:
Value or
Noneif not found.- Return type:
Any
Note
The
getmethod is an alias for the__getitem__method. So you can usecache_inst.get(key)orcache_inst[key]interchangeably.
- put(key, value)[source]
Put value by key.
- Parameters:
key (Any) – Any Hashable object.
value (Any) – Any object.
- Return type:
None
Note
The
putmethod is an alias for the__setitem__method. So you can usecache_inst.put(key, value)orcache_inst[key] = valueinterchangeably.- Return type:
None- Parameters:
key (Any) –
value (Any) –
- remove(key)[source]
Remove key.
- Parameters:
key (Any) – Any Hashable object.
- Return type:
None
Note
The
removemethod is an alias for the__delitem__method. So you can usecache_inst.remove(key)ordel cache_inst[key]interchangeably.- Return type:
None- Parameters:
key (Any) –
- property hits: int
Hits count.
- Returns:
Hits count.
- Return type:
int