Repository navigation
chore(deps): require utopia-php/cache ^8.0 - #1075
Conversation
Cache 8.0.0 stores empty arrays. Every value database saves is a non-empty wrapper array or a non-empty string, and every read checks === false/null or is_array, so no code change is needed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
🟢 Tier S · Ready to mergeThe Composer constraint for
📂 Walkthrough · 2
Reviewed |
Issue / Description
utopia-php/cache8.0.0 stores empty arrays:save($key, [])used to be refused because adapters checkedempty($data), and now it is kept. Empty strings (and'0') are still refused. Consumers such as appwrite-labs/edge want to move to cache 8 so they can cache[]directly, but database's"^6.1.3 || ^7.0"constraint blocks it.Solution
composer.json:"utopia-php/cache": "^8.0"(a single caret range).composer.lock: onlyutopia-php/cachemoves, 6.1.3 to 8.0.0. Nothing else changes.No code changes. Database does not use anything that cache 7 removed (
Cache::legacy(),Feature\Legacy,getGeneration).getLease,saveWithLease,loadVersionedandcompareAndSwapare unchanged in 8.I checked every place that saves to or loads from the cache, to see whether storing
[]changes anything:src/Database/Cache/Mutation.php:38-42loadVersioned, a miss is=== falsesrc/Database/Cache/Mutation.php:69['owners' => $owners], which is never[]even with no ownerssrc/Database/Cache/Query.php:103-105find()cache load, a miss is=== false || === null, then the shape is checkedsrc/Database/Cache/Query.php:167{version, epoch, field, documents}. An empty result givesdocuments: []inside a non-empty wrapper, which cache 6/7 already storedsrc/Database/Trait/Documents.php:796,798$emptymarker, not[]src/Database/Trait/Documents.php:922,944is_arrayon a non-empty{epoch, field, document}wrappersrc/Database/Trait/Documents.php:1005,1047src/Database/Trait/Documents.php:705if ($cached)on the inner document. It is never[], because absence uses the marker. If it ever were[], it is falsy, so the read falls through to the database (a safe miss)src/Database/Trait/Documents.php:3874,3911-3914withCacheepoch: saves a random hex string, a miss is=== false || === nullsrc/Database/Trait/Documents.php:3932-3938,4035withCachevalue: a miss is!== false && !== null. The saved value always comes fromencodeCacheValue()(:4049), which wraps it (['value' => ...]or{collection, type, value}), so a callback that returns[]is still saved as a non-empty arrayDatabase never saves a top-level
[]and never reads[]as a miss, so cache 8's change does not reach it.Appwrite already runs database 10.1.x against the monorepo cache that stores
[]. That backs this up, but CI here is the real check.Tests
🤖 Generated with Claude Code
Summary by CodeRabbit