RSSCache

mod:

RSSCache

Extension of DictCache to be used within RSS

class DIRAC.ResourceStatusSystem.Utilities.RSSCache.RSSCache(lifeTime, updateFunc=None, cacheHistoryLifeTime=None)

Bases: object

Cache with purgeThread integrated

__init__(lifeTime, updateFunc=None, cacheHistoryLifeTime=None)

Constructor

acquireLock()

Acquires RSSCache lock

get(resourceKey)

Gets the resource(s) status(es). Every resource can have multiple statuses, so in order to speed up things, we store them on the cache as follows:

{ (<resourceName>,<resourceStatusType0>) : whatever0,
  (<resourceName>,<resourceStatusType1>) : whatever1,
}
getBulk(resourceKeys)

Gets values for resourceKeys in one ATOMIC operation.

getCacheHistory()

Return the cache updates history

getCacheKeys()

List all the keys stored in the cache.

getCacheStatus()

Return the latest cache status

isCacheAlive()

Returns status of the cache refreshing thread

refreshCache()

Clears the cache and gets its latest version, not Thread safe ! Acquire a lock before using it ! ( and release it afterwards ! )

refreshCacheAndHistory()

Method that refreshes the cache and updates the history. Not thread safe, you must acquire a lock before using it, and release it right after !

releaseLock()

Releases RSSCache lock

resetCache()

Reset cache.

setCacheHistoryLifeTime(cacheHistoryLifeTime)

Set cache life time

setLifeTime(lifeTime)

Set cache life time

startRefreshThread()

Run refresh thread.

stopRefreshThread()

Stop refresh thread.