BloombergLP::bdlt::TimetableCache

Efficient cache of read-only bdlt::Timetable objects.

Synopsis

Declared in <bdlt_timetablecache.h>

class TimetableCache;

Description

This class implements an efficient cache of read-only bdlt::Timetable objects that are loaded into the cache, using a timetable loader supplied at construction, as a side-effect of the getTimetable manipulator. Timetables in the cache can be invalidated, and removed from the cache via the invalidate and invalidateAll methods. In addition, timetables in the cache can be made to expire based on a timeout that may be optionally supplied at construction. The bsl::shared_ptr<const bdlt::Timetable> objects returned from the getTimetable and lookupTimetable methods allow for the safe removal of timetables from the cache that may still have outstanding references to them.

This container is exception neutral with no guarantee of rollback: if an exception is thrown during the invocation of a method on a pre-existing instance, the container is left in a valid state, but its value is undefined. In no event is memory leaked.

This class is fully thread-safe (see bsldoc_glossary).

Member Functions

NameDescription
TimetableCache [constructor]Constructors
~TimetableCache [destructor]Destroy this object.
getTimetable Return a shared pointer to the named timetable, loading it if needed.
invalidate Invalidate and remove the named timetable from this cache.
invalidateAll Invalidate and remove all timetables from this cache.
lookupLoadTime Return the UTC datetime when the named timetable was loaded.
lookupTimetable Look up a timetable by name without loading it.
operator BloombergLP::bslmf::NestedTraitDeclaration<TimetableCache, UsesBslmaAllocator> Declare that this type uses a bslma allocator.