A CQRS-flavoured data fetching and caching layer in TypeScript. Batching, caching, data-dependencies and manual invalidations in a declarative fashion for Node and the browser
at the moment invalidate API always asks you to specify a unique key of the cache (aka input) to invalidate (unless the type of input is the singleton type, in which case it is inferred automagically). This means that you don't have a way to invalidate a whole Cache, only its single entries. I argue that in the lifecycle of an App session, data is often fetched for just one combination of input and this strictness adds unnecessary boilerplate.
Think of a user query that takes a password and a username, there will always be a unique user in memory and we want to wipe the whole cache when the user logout. It would be nice to be able to wipe the whole Cache without specifying the single key.
The proposal is to always allow empty inputs when invalidating a cache, with the logical addition that no input == whole cache invalidation, which is (probably not by chance) also the logical consequence of invalidating a query that accepts no params.
at the moment
invalidate
API always asks you to specify a unique key of the cache (akainput
) to invalidate (unless the type ofinput
is the singleton type, in which case it is inferred automagically). This means that you don't have a way to invalidate a wholeCache
, only its single entries. I argue that in the lifecycle of an App session, data is often fetched for just one combination ofinput
and this strictness adds unnecessary boilerplate.Think of a
user
query that takes apassword
and ausername
, there will always be a unique user in memory and we want to wipe the whole cache when the user logout. It would be nice to be able to wipe the wholeCache
without specifying the single key.The proposal is to always allow empty
inputs
when invalidating a cache, with the logical addition thatno input == whole cache invalidation
, which is (probably not by chance) also the logical consequence of invalidating a query that accepts noparams
.