Skip to content

CacheKey

Wyatt Greenway edited this page Aug 25, 2022 · 18 revisions

class CacheKey

Used as a unique key for cache. Caches will generally be stored in a Map, and since a Map's keys can be any instance, we use a "CacheKey" object on Models that will change when they are dirty. This will allow downstream libraries to use this "dirty" key as a cache key.

method CacheKey::constructor(number: number)

A "number" argument is provided here as a way to get an "id" from a CacheKey. Another way to view this "number" is a cache version. This number is incremented every time a model's fields get dirty.

Arguments:

  • number: number

    An incrementing number, or "version" for the CacheKey.

Return value: CacheKey


method CacheKey::valueOf()

Return the "number" or "version" of this CacheKey.

Return value: number



Clone this wiki locally