fix(cache): observe action cache hits and keep appendToKey (B1–B2) - #3413
Merged
Conversation
cachingSpec only asserted processAction toBeTrue. $cacheSettingsForAction last-wins and drops appendToKey, unlike processAction first-match. Signed-off-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Peter Amiri <peter@alurium.com>
$cacheSettingsForAction now breaks on the first match like processAction and keeps appendToKey. $addToCache / $getFromCache / $clearCache take wheelsCacheStore. Cull and silent-drop policy are unchanged. Signed-off-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Peter Amiri <peter@alurium.com>
caches() now requires named actions. testing stays cache-off. Action keys include session/user. clearCachableActions drops bodies. $clearCache() keeps category buckets. caches(Foo) matches foo. Stored false is boxed so $getFromCache does not treat it as a miss. Signed-off-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Peter Amiri <peter@alurium.com>
$getFromCache must give back a stored falsey payload instead of collapsing it into a miss. A miss is only an absent, expired, or culled key. $isCacheMiss() now reads the last lookup, not the value. Signed-off-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Peter Amiri <peter@alurium.com>
B2 first-match returns the leftover default time=60 row that earlier dummy specs leave on the controller class. Clear before caches() so the time=100 row is the first match. Signed-off-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Peter Amiri <peter@alurium.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Cache hardener for BLOCKERs B1–B2 and SHOULDs S1–S9. Peter flipped S1/S2/S3/S6/S7/S8. S9 is in. Base is develop after #3412 (
26f71776568c1360b12b3025f96479abbb009f61).cacheFileCheckingstays true.caches()still defaultstime=60/static=falsewhen an action is named.Scope
vendor/wheels/controller/caching.cfc— B2 first-match +appendToKey; S1 named actions; S6 body drop; S8CompareNoCasevendor/wheels/events/init/caching.cfm— S2 testing stays cache-offvendor/wheels/global/cache.cfm— S3 session/user action key; S5 store lock; S7 targeted$clearCache(); S9 stored false is a hit; S6 action key indexvendor/wheels/tests/specs/caching/CacheHardenerSpec.cfc— Desk IDs B1–B2 / S1–S9vendor/wheels/tests/specs/controller/cachingSpec.cfc— B1 write/hit/key; S1 no-action throw;$cacheSettingsForActionclears leftoverdummy1beforecaches(time=100)so first-match is not the earlier defaulttime=60rowOut of scope: CLI, ManifestCache, model query/schema cache, Global leftover S4 (catch swallow).
PROVEN
cachingSpecand CacheHardenerSpec observe write, hit, and the session-qualified store key, not onlyprocessActiontoBeTrue$cacheSettingsForActionfirst-matches likeprocessActionand keepsappendToKey. Not an ESCALATE: publiccaches()runtime stays first-match.cachingSpecnow clears before the time=100 lookup so leftover dummy1 does not wincaches()/caches(static=true)with no action throwsWheels.InvalidArgument. Explicitcaches(action="*")still allowedcacheActions/Pages/Partials/Images/Queriesenable only when environment is notdevelopmentortesting$actionCacheKeyfolds$sessionCacheIdentity()(session.user.id / session.user / sessionid) so alice/bob params-only pages do not leak$addToCachestill silent-drops when full after cull. Cull/drop policy unchanged$addToCache/$getFromCache/$clearCachetake exclusivewheelsCacheStore. add/get/clear values unchangedclearCachableActionsdrops this controller's action bodies viacacheActionIndex. A decoy key for another controller stays$clearCache()clears each category in place and keeps themain/actionbuckets. ParentStructClear(application.wheels.cache)is gonecaches("CachedShow")matches actioncachedShowin$cacheSettingsForActionandprocessAction$addToCache(key, false)then$getFromCache(key)returnsfalseas a hit. A miss is only absent / expired / culled.$isCacheMiss()reads the last lookup, not the value. Missing keys still returnfalseTradeoffs
B2 aligns the test getter to
processActionfirst-match. That is not a public last-wins flip.S3 suffixes only
category=actionstore keys. Page/partial/query$hashedKeyconsumers are unchanged.S6 indexes keys at
$addToCachewhenvariables.$class.nameis present. No full-bucket wipe of every controller.S9 returns the stored payload, including
false. Public miss for an absent key is stillfalse. Distinguish with$isCacheMiss()(last lookup).$doubleCheckedLockstill treats a boolean-false return as a miss, so a cached boolean false will re-execute on the DCL path.Blast Radius
Apps that called
caches()with no action now getWheels.InvalidArgument. Testing no longer enables action/page/partial/image/query caches at boot. Action cache entries are per session/user.$clearCache()no longer destroys category structs. Callers that stored boolean false and compared the get result withfalsemust use$isCacheMiss()to tell a hit from a miss.Verification
LuCLI 32796766018 failed
cachingSpec“is getting cache settings for action” (Expected [100] but received [60]) because leftoverdummy1at default time=60 was first-match. That spec now calls$clearCachableActions()first.$cacheSettingsForActionstays first-match.Lucee 7.0.0.395 / sqlite
HEAD
b9e209137815fd5a787ffdea6697b633ef35537c