Skip to Content
APIConfigurationClass: CacheManager

Class: CacheManager

CacheManager - Facade for managing multiple typed caches

Replaces the old Cache singleton with a more flexible, configurable system. Supports:

  • Multiple cache types (places, routes, configurations, etc.)
  • Language-aware caching
  • Optional localStorage persistence
  • Configurable limits and TTL per cache type

Example

CacheManagerConfig

Constructors

Constructor

CacheManager

Parameters

config?

CacheManagerConfig

Returns

CacheManager

Methods

cleanAccessibleRoutesCache()

void

Returns

void


cleanAllCache()

void

Clears all caches

Returns

void


cleanLanguageCache()

string

Clears all entries for a specific language across all language-aware caches

Parameters

lang

string

Returns

void


cleanRoutesCache()

void

Returns

void


getAccessibleRoute()

void

Type Parameters

T

T

Parameters

destinationId

string

Returns

undefined | T


getAllCacheStats()

T

Gets statistics for all caches

Returns

Record<CacheType, CacheStats>


getCacheStats()

string

Gets statistics for a specific cache type

Parameters

cacheType

CacheType

Returns

CacheStats


getCategories()

undefined

Type Parameters

T

T

Parameters

placeId

string

lang

string

Returns

undefined | T


getConfiguration()

T

Type Parameters

T

T

Parameters

placeId

string

product

string

lang

string

Returns

undefined | T


getPlace()

Record

Type Parameters

T

T

Parameters

id

string

lang

string

Returns

undefined | T


getRoute()

CacheType

Type Parameters

T

T

Parameters

destinationId

string

Returns

undefined | T


getStops()

CacheStats

Type Parameters

T

T

Parameters

id

string

lang

string

Returns

undefined | T


getSubPlaces()

CacheType

Type Parameters

T

T

Parameters

parentPlaceId

string

lang

string

Returns

undefined | T


getVehicle()

CacheStats

Type Parameters

T

T

Parameters

id

string

lang

string

Returns

undefined | T


hasPlace()

T

Parameters

id

string

lang

string

Returns

boolean


setAccessibleRoute()

string

Type Parameters

T

T

Parameters

destinationId

string

value

T

Returns

void


setCategories()

string

Type Parameters

T

T

Parameters

placeId

string

lang

string

value

T

Returns

void


setConfiguration()

undefined

Type Parameters

T

T

Parameters

placeId

string

product

string

lang

string

value

T

Returns

void


setPlace()

T

Stores a place in cache

Type Parameters

T

T

Parameters

id

string

Place ID

value

T

Place data

lang

string

Language code

Returns

void


setRoute()

T

Type Parameters

T

T

Parameters

destinationId

string

value

T

Returns

void


setStops()

string

Stores stops in cache

Type Parameters

T

T

Parameters

id

string

Combined stop+vehicle ID

value

T

Stops data (can be DataSnapshot for backward compatibility)

lang

string

Language code

Returns

void


setSubPlaces()

string

Stores subplaces in cache

Type Parameters

T

T

Parameters

parentPlaceId

string

Parent place ID

lang

string

Language code

value

T

SubPlaces data (can be DataSnapshot for backward compatibility)

Returns

void


setVehicle()

string

Stores a vehicle in cache

Type Parameters

T

T

Parameters

id

string

Stop ID

value

T

Vehicle data (can be DataSnapshot for backward compatibility)

lang

string

Language code

Returns

void

Last updated on