Module markov.api.utils.disk_cache
Classes
class DiskCache (path: str)-
Helper class that provides a standard way to create an ABC using inheritance.
Ancestors
- abc.ABC
Subclasses
Methods
def clear_all(self)-
Clears all the stored objects for the given cache Returns: void
def exists(self, key: str) ‑> bool-
Check of the key exists in the cache. Returns true if it does else false
Args
key:str- unique identifier of the key
Returns
True of the key exists otherwise False
def get(self, key: str) ‑> ~Tdef remove(self, key: str)def save(self, key: str, value: ~T)-
Save the object given by value with unique identifier key
Args
key:str- unique key identifier
value:Any- object to be stored
Returns
saved object
class ModelCache-
Helper class that provides a standard way to create an ABC using inheritance.
Ancestors
- DiskCache
- abc.ABC
Methods
def get(self, key: str) ‑> ~T-
Get the model with the key, {key}, usually the key is the model_id
Args
key:str- unique identifier for the model to be fetched
Returns
pickle load version of the model
def remove(self, key: str)-
Remove the artifact with the key from the disk
Args
key:str- artifact key to be removed from cache
Returns
void
def save(self, key: str, value: Any)-
Save the object given by value with user provided key {key} in the cache
Args
key:str- unique identifier for the object to be saved on local cache
value:Any- model object (TBD)
Returns
void
Inherited members
class PandasDFCache-
Cache to store the dataframe in the local disk for quick retrieval
Ancestors
- DiskCache
- abc.ABC
- typing.Generic
Methods
def get(self, key: str) ‑> ~Tdef remove(self, key: str)-
Remove the key if it exists otherwise nothing will happen
Args
key:str- key to remove
Returns
void
def save(self, key, df: ~T)-
Save the object given by value in the cached
Args
key:str- unique identifier to identify this dataframe (usually it's ds_id_segment_type for datasets)
df:pd.Dataframe- dataframe to store in the cache
Returns
void
Inherited members