@wolfstar/plugin-cache. The plugin is a storage-agnostic Discord entity cache, in memory or in Redis, and the cache behind the managers of @wolfstar/plugin-gateway. For the weekly summary across all packages, see the changelog overview.
0.8.0 (2026-10-20)
New features
- Own
stars.configkey — The module setsmeta.configKey, so you can write its options under the top-levelcachekey ofstars.configinstead of the[specifier, options]tuple ofmodules. The tuple still works and is merged over the key. The key is typed indefineConfigonce the module is imported instars.config.ts.cachetakes no options yet and only reserves its name. (#259)
Updates
- New optional peer —
@wolfstar/schema(^0.9.0) is a new optional peer that carries theStarsConfigtype the keys extend.
Migration
@wolfstar/kitpeer raised — The@wolfstar/kitpeer range moves from^0.1.0to^0.2.0, the first version that readsconfigKey. If your project uses@wolfstar/kit0.1, update it.
0.7.0 (2026-10-07)
New features
- Voice channel status and start time —
VOICE_CHANNEL_STATUS_UPDATE,VOICE_CHANNEL_START_TIME_UPDATE, andCHANNEL_INFOnow patch thestatusandvoice_start_timeof a cached channel. Uncached channels stay uncached. #223
0.6.0 (2026-10-05)
New features
@wolfstar/plugin-cache/module— List it inmodulesinstars.configto add the package to the auto imports. It needs framework 6.1 and the optional@wolfstar/kitpeer. The main entrypoint is unchanged. #189
0.5.1 (2026-10-02)
Bug fixes
- Bot reaction count — A
MESSAGE_REACTION_ADDfor the bot’s own reaction is no longer counted again when the cached reaction already hasmeset. #169
Updates
- discord.js parity — Structure members that had discord.js names now match its contracts. Breaking for
@wolfstar/plugin-gateway:Message#react()resolves to theMessageReactioninstead of the message, and counts the bot on the message and on its cached entry;Message#attachments,Message#stickers,Message#messageSnapshotsandReactionManager#cacheareCollections instead of arrays;Message#stickersholds partialStickerstructures;Message#partialistruewhen the message lacks its content, not only its author; andvalueOf()of a structure is its ID.MESSAGE_REACTION_ADDfor the bot’s own reaction is no longer counted when the cached reaction already hasmeset. (#169)
0.5.0
Aligns the cache with the discord.js RFC #11426 (zero caching, complete flexibility).
New features
- Partial caches — Every entity cache is now optional, and an entity kind the cache does not hold is not cached.
createInMemoryCacheandcreateRedisCachetakeentitiesto pick them.createCache({ makeCache, policies })builds a cache out of any store per entity kind. - Policies — Set
{ filter(value, key), ttl(value, key) }per entity kind and apply it to any store withwithPolicy(store, policy). Afilterreturningfalseskips the write and deletes the cached entry.ttlsets the entry’s time-to-live. upsert()—EntityCachegainsupsert(key, data, { overwrite, ttl }), which resolves to{ existing, added }.setnow takes{ ttl }in milliseconds (nullfor none).- In-memory time-to-live —
MemoryEntityCachesupportsttl,sweepInterval,sweep(), anddispose().createInMemoryCachetakesttlandsweepInterval.
Updates
- Optional enumeration —
keys,values, andentriesmoved toIterableEntityCache. Check a store withisIterableCache.applyCacheOperationsskips missing stores and the scans of stores that cannot enumerate. - Operation results —
applyCacheOperationsandapplyGatewayDispatchresolve toCacheOperationResult[]({ entity, key, type, existing, added }). - Deprecated aliases —
InMemoryCacheandRedisCacheare now deprecated aliases ofCache.
Migration
Custom stores must implementupsert and accept the options of set. Code that reads cache.users directly must handle undefined.
0.4.0
New features
- Pluggable Redis codec —
createRedisCacheandRedisEntityCacheaccept acodecoption (jsonCodec()by default, matching the previous behaviour). AmsgpackCodec()backed bymsgpackris available from the new@wolfstar/plugin-cache/msgpacksubpath, which needs the optionalmsgpackrpeer dependency. - Safe codec switching — Encoded values are tagged with the codec’s name, so switching to a codec is always safe. Switching away from a non-default codec requires listing it in the new
legacyCodecsoption so its entries keep decoding. The names"gz","br", and"b64"are reserved.
0.3.0
New features
- Resume gateway sessions across restarts —
createRedisSessionStore(with attl, 10 minutes by default) and theGatewaySessionStoreandGatewaySessionInfotypes let a new process resume the sessions of the previous one. Pair it with thesessionStoreoption ofGatewayClient. - Synchronous reads —
EntityCachegains an optional, readonlysynchronousflag:truefor in-memory caches,falsefor Redis. Managers use it forcached(...ids), for exampleclient.members.cached(guildId, userId).
Bug fixes
./registerexport — Adds a no-op./registersubpath export. The Stars CLI build imports<name>/registerfor every@wolfstar/plugin-*dependency, so the package crashed consumers at startup withERR_PACKAGE_PATH_NOT_EXPORTED.
0.2.0
New features
- Guild index for Redis — Guild-scoped Redis entity caches are indexed by guild (
indexGuilds, on by default). AGUILD_DELETEdrops a guild’s entries through the index instead of scanning every entry of every entity cache.EntityCachegains an optionaldeleteGuild.
0.1.0
New features
- New package —
@wolfstar/plugin-cacheis a storage-agnosticCacheinterface with oneEntityCacheper Discord entity, andapplyGatewayDispatchto write gateway dispatches into it, cascading deletes included. - Two stores —
createInMemoryCache(optionally LRU-bounded) andcreateRedisCache(per-entity TTL and optional gzip or brotli compression). - Reactions and poll votes — Reactions and poll votes are counted into the cached message. Pass
{ clientUserId }toapplyGatewayDispatchfor themeandme_votedflags. - Scheduled event creators — The creator of a scheduled event is cached in
users.
Bug fixes
- Atomic Redis writes — Redis values and their index entries are written and deleted together in a single
MULTItransaction, and expired index entries are pruned on every write when attlis set. - Unreadable values — Invalid JSON or corrupt compressed bytes are rejected with a
CacheValueErrornaming the key.