Optional
Readonly
Internal
__cacheReadonly
dotThe s
flag.
false
Readonly
globalThe g
flag.
false
Readonly
hasThe d
flag.
false
Readonly
ignoreThe i
flag.
false
Readonly
multilineThe m
flag.
false
Readonly
stickyThe y
flag.
false
Readonly
unicodeThe u
flag.
false
Readonly
unicodeThe v
flag.
false
A cache that functions may use to store results.
A cache implements the ReadonlyFlags interface. All functions that take a ReadonlyFlags objects can be given a cache instead to utilize the cache. Example:
Whether the cache is actually utilized depends on the implementation of the function.
To get a cache for some flags, use the toCache function.
Assumption
Caches assume that the regexpp AST of cached nodes is immutable. If this assumption is broken, then the cache may return old or incorrect results.
The AST may be changed before the cache first sees a node of the AST and after the cached last sees a node of the AST. Changes are allowed as long as the AST appears to be immutable from the perspective of the cache.
Memory
The cache uses regexpp
Node
objects as keys inWeakMap
s internally. They will not cause memory leaks.This means that caches may out-live the nodes they cache information for.
See