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

Efficient cache of read&hyphen;only `bdlt&colon;&colon;Calendar` objects&period;

== Synopsis

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

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

== Description

This class implements an efficient cache of _read&hyphen;only_ `bdlt&colon;&colon;Calendar` objects that are loaded into the cache, using a calendar loader supplied at construction, as a side&hyphen;effect of the `getCalendar` manipulator&period; Calendars in the cache can be invalidated, and removed from the cache via the `invalidate` and `invalidateAll` methods&period; In addition, calendars 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;Calendar&gt;` objects returned from the `getCalendar` and `lookupCalendar` methods allow for the safe removal of calendars from the cache that may still have outstanding references to them&period;

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/CalendarCache/2constructor-0f.adoc[`CalendarCache`]         [.small]#[constructor]#
| Constructors
| xref:BloombergLP/bdlt/CalendarCache/2destructor.adoc[`&#126;CalendarCache`] [.small]#[destructor]#
| Destroy this object&period;
| xref:BloombergLP/bdlt/CalendarCache/getCalendar.adoc[`getCalendar`] 
| Return a shared pointer to the named calendar, loading it if needed&period;
| xref:BloombergLP/bdlt/CalendarCache/invalidate.adoc[`invalidate`] 
| Invalidate and remove the named calendar from this cache&period;
| xref:BloombergLP/bdlt/CalendarCache/invalidateAll.adoc[`invalidateAll`] 
| Invalidate and remove all calendars from this cache&period;
| xref:BloombergLP/bdlt/CalendarCache/lookupCalendar.adoc[`lookupCalendar`] 
| Return a shared pointer to the calendar named `calendarName`&period;
| xref:BloombergLP/bdlt/CalendarCache/lookupLoadTime.adoc[`lookupLoadTime`] 
| Return the UTC datetime when the named calendar was loaded&period;
|===



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