keystone.common.cache.core module¶
Keystone Caching Layer Implementation.
- class keystone.common.cache.core.DistributedInvalidationStrategy(region_manager)[source]¶
Bases:
RegionInvalidationStrategy- invalidate(hard=None)[source]¶
Region invalidation.
CacheRegionpropagated call. The default invalidation system works by setting a current timestamp (usingtime.time()) to consider all older timestamps effectively invalidated.
- is_hard_invalidated(timestamp)[source]¶
Check timestamp to determine if it was hard invalidated.
- Returns:
Boolean. True if
timestampis older than the last region invalidation time and region is invalidated in hard mode.
- is_invalidated(timestamp)[source]¶
Check timestamp to determine if it was invalidated.
- Returns:
Boolean. True if
timestampis older than the last region invalidation time.
- is_soft_invalidated(timestamp)[source]¶
Check timestamp to determine if it was soft invalidated.
- Returns:
Boolean. True if
timestampis older than the last region invalidation time and region is invalidated in soft mode.
- class keystone.common.cache.core.RegionInvalidationManager(invalidation_region, region_name)[source]¶
Bases:
object- REGION_KEY_PREFIX = '<<<region>>>:'¶
- property region_id¶
- keystone.common.cache.core.create_region(name)[source]¶
Create a dopile region.
Wraps oslo_cache.core.create_region. This is used to ensure that the Region is properly patched and allows us to more easily specify a region name.
- Parameters:
name (str) – The region name
- Returns:
The new region.
- Return type:
dogpile.cache.region.CacheRegion
- keystone.common.cache.core.get_memoization_decorator(group, expiration_group=None, region=None)[source]¶
- keystone.common.cache.core.is_replay(region, key, expiration_time=None)[source]¶
Return whether
keyhas already been recorded inregion.Check this before honoring a one-time-use value (nonce, passcode, receipt, …), then call
mark_used()once it is consumed.- Parameters:
region – a configured dogpile CacheRegion.
key – the identifying string for the one-time-use value.
expiration_time – seconds to honor a recorded value for, overriding the region’s own expiration_time. Pass the value’s real validity window plus a margin, so protection isn’t at the mercy of an operator’s general-purpose
[cache] expiration_time.
- Returns:
True if
keywas already recorded (a replay).
- keystone.common.cache.core.mark_used(region, key)[source]¶
Record
keyinregionfor a lateris_replay()check.Expiration is enforced on the read side by
is_replay().