Extends
Members
-
Returns all cached instances of an BaseCacheableObject. If no cache exists, a cache object is created. This implementation ensures each class has a unique cache of only instances of the BaseCacheableObject that does not overlap with other BaseCacheableObject classes. The keys of the cache should use the caching id implemented in
getCacheId
. -
Sets the cache object.
-
The class name. Minification will break
this.constructor.name
; this allows for readable logging even in minified code.
Methods
-
Defers to
BaseObject._populateObject
and then caches the instance using the caching id fromgetCacheId
. -
Resets cache to an empty object.
-
BaseCacheableObject.get (id)BaseCacheableObject | undefined static
-
Returns a cached instance matching the passed caching id if it exists. Otherwise, returns undefined.
Name Type Description id
Number This id must match the form of the caching id provided by
getCacheId
.Returns:
Type Description BaseCacheableObject | undefined -
Constructs and returns an id for the cache if possible from the passed params. If construction is not possible, returns undefined.
Name Type Description idParams
Object Returns:
Type Description string | undefined -
Should be overridden by each subclass. Returns an object containing all IDs used for API requests and caching.
Returns:
Type Description Object -
Returns the id used for caching. Important for classes that have multiple identifiers. Example: League is identified by its
leagueId
and itsseasonId
. This method prevents separate seasons from overriding each other's data.Returns:
Type Description String | undefined -
Returns an object containing all IDs used for API requests and caching for the instance.
Returns:
Type Description Object