[#BloombergLP-bdlt-TimetableCache]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlt.adoc[bdlt]::TimetableCache
:relfileprefix: ../../
:mrdocs:

This class implements an efficient cache of _read&hyphen;only_ `bdlt&colon;&colon;Timetable` objects that are loaded into the cache, using a timetable loader supplied at construction, as a side&hyphen;effect of the `getTimetable` manipulator&period; Timetables in the cache can be invalidated, and removed from the cache via the `invalidate` and `invalidateAll` methods&period; In addition, timetables in the cache can be made to expire based on a timeout that may be optionally supplied at construction&period; The `bsl&colon;&colon;shared&lowbar;ptr&lt;const bdlt&colon;&colon;Timetable&gt;` 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&period;

== Synopsis

Declared in `&lt;bdlt&lowbar;timetablecache&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class TimetableCache;
----

== Description

This container is _exception_ _neutral_ with no guarantee of rollback&colon; if an exception is thrown during the invocation of a method on a pre&hyphen;existing instance, the container is left in a valid state, but its value is undefined&period; In no event is memory leaked&period;

This class is fully thread&hyphen;safe (see `bsldoc&lowbar;glossary`)&period;

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlt/TimetableCache/2constructor-07.adoc[`TimetableCache`]         [.small]#[constructor]#
| Constructors
| xref:BloombergLP/bdlt/TimetableCache/2destructor.adoc[`&#126;TimetableCache`] [.small]#[destructor]#
| Destroy this object&period;
| xref:BloombergLP/bdlt/TimetableCache/getTimetable.adoc[`getTimetable`] 
| Return a shared pointer providing non&hyphen;modifiable access to the timetable having the specified `timetableName` in this timetable cache, loading the timetable into the cache using the loader that was supplied at construction if the timetable is not already present in the cache or if the timetable has expired (i&period;e&period;, per a timeout optionally supplied at construction)&period; If the loader fails, whether in loading a timetable for the first time or in reloading a timetable that has expired, return an empty shared pointer&period;
| xref:BloombergLP/bdlt/TimetableCache/invalidate.adoc[`invalidate`] 
| Invalidate the timetable having the specified `timetableName` in this timetable cache, and remove it from the cache&period; If a timetable having `timetableName` is not present in this cache, this method has no effect&period; Return the number of timetables that were invalidated&period; Note that a timetable that has been invalidated in the cache remains valid to all outstanding references to it, obtained via earlier calls to the `getTimetable` and `lookupTimetable` methods, until all of those references have been destroyed&period;
| xref:BloombergLP/bdlt/TimetableCache/invalidateAll.adoc[`invalidateAll`] 
| Invalidate all timetables in this timetable cache, and remove them from the cache&period; Return the number of timetables that were invalidated&period; Note that a timetable that has been invalidated in the cache remains valid to all outstanding references to it, obtained via earlier calls to the `getTimetable` and `lookupTimetable` methods, until all of those references have been destroyed&period;
| xref:BloombergLP/bdlt/TimetableCache/lookupLoadTime.adoc[`lookupLoadTime`] 
| Return the datetime, in Coordinated Universal Time (UTC), at which the timetable having the specified `timetableName` was loaded into this timetable cache&period; If the timetable having `timetableName` is not found in the cache, or if the timetable has expired (i&period;e&period;, per a timeout optionally supplied at construction), return `Datetime()`&period;
| xref:BloombergLP/bdlt/TimetableCache/lookupTimetable.adoc[`lookupTimetable`] 
| Return a shared pointer providing non&hyphen;modifiable access to the timetable having the specified `timetableName` in this timetable cache&period; If the timetable having `timetableName` is not found in the cache, or if the timetable has expired (i&period;e&period;, per a timeout optionally supplied at construction), return an empty shared pointer&period;
| xref:BloombergLP/bdlt/TimetableCache/2conversion.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration&lt;TimetableCache, UsesBslmaAllocator&gt;`] 
| 
|===



[.small]#Created with https://www.mrdocs.com[MrDocs]#
