Cascade
Loading...
Searching...
No Matches
Buzzware.Cascade.MetaCache Class Reference

The MetaCache class provides caching functionality for metadata associated with CascadeDataLayer. It enables loading, storage, retrieval, and clearing of metadata in a dictionary structure, maintaining a local cache and synchronizing changes with the CascadeDataLayer. As metadata is implemented using files, this cache can be used for fast UI updates by avoiding file access. More...

Public Member Functions

 MetaCache (CascadeDataLayer cascade, string metaPath)
 MetaCache Constructor Initializes a new MetaCache with a specified data layer and metadata path.
void Load ()
 Loads metadata from the metaPath directory into the local cache. Clears the existing cache and fetches fresh metadata from the data layer.
void MetaSet (string path, string value)
 Sets metadata for a specific path in both the local cache and the data layer.
void MetaSetExists (string path, bool value)
 Sets the existence of metadata for a specific path in both the local cache and the data layer.
string MetaGet (string path, string value)
 Retrieves the metadata value associated with a specific path from the local cache.
bool MetaGetExists (string path)
 Checks for the existence of metadata for a specific path in the local cache.
void MetaClear (DateTime? olderThan=null)
 Clears metadata from the local cache and optionally removes files older than a specified date from the data layer.
IEnumerable< string > MetaList ()
 Provides a list of all metadata keys present in the local cache.

Detailed Description

The MetaCache class provides caching functionality for metadata associated with CascadeDataLayer. It enables loading, storage, retrieval, and clearing of metadata in a dictionary structure, maintaining a local cache and synchronizing changes with the CascadeDataLayer. As metadata is implemented using files, this cache can be used for fast UI updates by avoiding file access.

Constructor & Destructor Documentation

◆ MetaCache()

Buzzware.Cascade.MetaCache.MetaCache ( CascadeDataLayer cascade,
string metaPath )
inline

MetaCache Constructor Initializes a new MetaCache with a specified data layer and metadata path.

Parameters
cascadeThe CascadeDataLayer instance used for metadata operations.
metaPathThe path to the directory where metadata files are stored.

Member Function Documentation

◆ MetaClear()

void Buzzware.Cascade.MetaCache.MetaClear ( DateTime? olderThan = null)
inline

Clears metadata from the local cache and optionally removes files older than a specified date from the data layer.

Parameters
olderThanAn optional parameter to specify a date. Files older than this date will be removed.

◆ MetaGet()

string Buzzware.Cascade.MetaCache.MetaGet ( string path,
string value )
inline

Retrieves the metadata value associated with a specific path from the local cache.

Parameters
pathThe relative path for which the metadata value is requested.
valueUnused parameter in the method, could be intended for future use.
Returns
The metadata value associated with the specified path.

◆ MetaGetExists()

bool Buzzware.Cascade.MetaCache.MetaGetExists ( string path)
inline

Checks for the existence of metadata for a specific path in the local cache.

Parameters
pathThe relative path for which the existence check is performed.
Returns
True if the metadata exists, otherwise false.

◆ MetaList()

IEnumerable< string > Buzzware.Cascade.MetaCache.MetaList ( )
inline

Provides a list of all metadata keys present in the local cache.

Returns
An enumerable containing all metadata keys stored in the local cache.

◆ MetaSet()

void Buzzware.Cascade.MetaCache.MetaSet ( string path,
string value )
inline

Sets metadata for a specific path in both the local cache and the data layer.

Parameters
pathThe relative path for the metadata.
valueThe metadata value to be set. If null, the metadata is removed.

◆ MetaSetExists()

void Buzzware.Cascade.MetaCache.MetaSetExists ( string path,
bool value )
inline

Sets the existence of metadata for a specific path in both the local cache and the data layer.

Parameters
pathThe relative path for the metadata.
valueA boolean indicating whether the metadata should exist (true) or be removed (false).

The documentation for this class was generated from the following file:
  • Buzzware.Cascade/utilities/MetaCache.cs