cinder_data.cache module

class cinder_data.cache.Cache

Bases: object

Cache interface.

get_record(name, record_id)

Should retrieve a record with a given type name and record id.

Parameters:
  • name (string) – The name which the record is stored under.
  • record_id (int) – The id of the record requested.
Raises:

NotImplementedError

Returns:

Should return the cached model.

Return type:

cinder_data.model.CinderModel

get_records(name)

Should get all the records in the cache under a given name.

Parameters:name (string) – The name which the records are stored under.
Raises:NotImplementedError
Returns:Should return a list of cinder_data.model.CinderModel models.
Return type:list
set_record(name, record_id, record)

Should save the record to the cache.

Parameters:
  • name (string) – The name which to store the record under.
  • record_id (int) – The id of the record.
  • record (cinder_data.model.CinderModel) – The model
Raises:

NotImplementedError – Description

class cinder_data.cache.MemoryCache

Bases: cinder_data.cache.Cache

A cache which uses in-process memmory.

Initialise the cache.

get_record(name, record_id)

Retrieve a record with a given type name and record id.

Parameters:
  • name (string) – The name which the record is stored under.
  • record_id (int) – The id of the record requested.
Returns:

The cached model.

Return type:

cinder_data.model.CinderModel

get_records(name)

Return all the records for the given name in the cache.

Parameters:name (string) – The name which the required models are stored under.
Returns:A list of cinder_data.model.CinderModel models.
Return type:list
set_record(name, record_id, record)

Save a record into the cache.

Parameters: