Powered by Tachyonic Project Luxon Framework v0.0.0

Luxon Framework for rapid application development. (luxon)

Version

Caching

Luxon provides a number of Cache options.

Cache

class luxon.core.cache.cache.Cache[source]

Caching class

Used to globally cache objects using the class specified in the settings.ini file

load(reference)[source]

Returns Cached Object

Parameters:reference (str) – reference to object to be loaded
Returns:object from cache
store(reference, obj, expire=60)[source]

Store object

Parameters:
  • reference (str) – reference to object
  • obj (obj) – object to be cached
  • expire (int) – time to expire (s)

Memory Cache

class luxon.core.cache.memory.Memory(max_objs=5000, max_obj_size=50)[source]

LRU Memory Cache.

Least Recently Used cache.

Cache has a fixed capacity and discards the oldest entries. This is specially useful if you have the need to control the cache memory usage.

Defaults are max_objects 5000 * max_obj_size of 50Kbytes is 250Mbyte.

Its reasonable to assume a host has atleast 250Mbytes * each process.

load(key)[source]

Loads cached data from key

Parameters:key (str) – key for required data
store(key, value, expire)[source]

Stores data

Parameters:
  • key (str) – key associated with cached data
  • value (obj) – data to be cached
  • expire (int) – time to expire (s)

Redis Cache

class luxon.core.cache.rd.Redis(max_objs=None, max_obj_size=50)[source]

Caches objects in Redis object store

load(key)[source]

Loads cached data from key

Parameters:key (str) – key for required data
store(key, value, expire)[source]

Stores data

Parameters:
  • key (str) – key associated with cached data
  • value (obj) – data to be cached
  • expire (int) – time to expire (s)

No Cache

class luxon.core.cache.nocache.NoCache(max_objs=5000, max_obj_size=50)[source]

Cache Helper

luxon.helpers.cache.cache(expire, func, *args, **kwargs)[source]