Repository navigation
Release 1.17.0: safe fixes, faster bulk invalidation, opt-in deserialization hardening - #59
Conversation
Bulk invalidation (flushTags, flushPatterns, invalidateModel, deleteMultiple, flushNamespace, clearManaged) now writes the managed-key index once instead of every 10 keys. flushNamespace() starts from the stored index. Metadata locks never re-run an update whose lock release failed. remember*() no longer serializes the value again for cost-aware scoring, and unserializable values no longer break put() through the metrics or deduplication hash. Orphan-chunk cleanup applies its changes to the stored registry instead of writing back a stale copy, so chunks registered meanwhile no longer leak. Turning lazy loading off applies to existing entries, materialize() keeps the collection class, lazy collections are JSON-serializable, and slice() accepts negative arguments. Async refreshes write to the store they were queued from. The dashboard page no longer runs healthCheck() and getStatistics() on every view. clear --force handles numeric keys, expired indexes, and keys it cannot read. SWR and stampede metadata use the framework clock. Plus memo, circuit breaker, cost-aware, and strategy robustness fixes, and an opt-in smart-cache.serializable_classes setting that applies Laravel's unserialize restriction to the payloads SmartCache decodes itself. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QhHekNUGyMR5yVX6UcshtR
Rewrite the README to lead with why teams adopt SmartCache and what makes it production-ready, keeping the essentials and linking the full docs for details. Add the 1.17.0 changelog entry with upgrade notes and the missing 1.15-1.17 compare links, document serializable_classes and the 1.17 behavior in docs/index.html, and list 1.17.x as the maintained line in SECURITY.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QhHekNUGyMR5yVX6UcshtR
Keep the managed-key index debounce for small bulk removals: batching now writes the index at the end only once 10 changes are pending (clearManaged() still writes it unconditionally, as before), so a model save that flushes one tag writes it no more often than 1.16 did. invalidate() is batched the same way. Throttle the invalid encryption pattern warning through the cache store to once an hour per pattern, since the strategy is rebuilt per request. Re-read cost-aware scores between requests and jobs only when the copy is older than a minute. Keep passing statistics and health to dashboard subclasses that override renderDashboard(). Replay a real 1.16 job payload in the rolling-deploy guard test, and correct the changelog: a 1.16 worker ignores the job's new property rather than logging a deprecation. List the remaining behavior fixes as upgrade notes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QhHekNUGyMR5yVX6UcshtR
README: chunking needs more than chunk_size items as well as 100 KB; the encryption snippet lives under strategies; clear() is the main (not the only) intentional difference; note the cache_locks table for the database driver and what clear --force deletes. Cite the Laravel 13 application skeleton for the serializable_classes default. List the smaller public API additions in the changelog, complete the internal key list in the docs, fix a stale sample version, and add PHP 8.5 and the PHPUnit 10 verbose flag to TESTING.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QhHekNUGyMR5yVX6UcshtR
Composer now blocks installing package versions with published security advisories during update/require, and every Laravel 8-11 release has one, so those matrix jobs failed while resolving dependencies, before any test ran (main's last run predates the change). Set COMPOSER_NO_BLOCKING (current name) and COMPOSER_NO_SECURITY_BLOCKING (Composer 2.9's name) on the install step. This only selects the framework version under test; package users are unaffected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QhHekNUGyMR5yVX6UcshtR
|
CI note: the first run went red at This isn't caused by the 1.17 changes. Fixed in 8bd69e9 by setting Generated by Claude Code |
Pull Request
Description
Release 1.17.0: fixes and performance improvements from a full audit of 1.16.0, with nothing for users to change.
SmartCachecontract is unchanged, and no default changes.serializable_classes, defaultnull.Performance
_sc_managed_keysindex under a lock. A tag flush covering thousands of keys rewrote an index of tens of thousands of keys hundreds of times. This coversflushTags(),tags()->flush(),flushPatterns(),invalidateModel(),invalidate(),deleteMultiple(), andflushNamespace(). Small removals keep the old schedule: a model save that flushes one tag writes the index no more often than in 1.16.remember()serializes large values less. It no longer re-serializes the value for the cost-aware size and the write metric. That saves about 3 ms per miss on a 2 MB payload, and the recorded numbers are the same.GET /smart-cache) no longer runsgetStatistics()andhealthCheck()on every view. Both read every managed value and their results were discarded;healthCheck()also pruned and evicted entries on a GET.memo()LRU eviction no longer sorts on every new key once the memo layer is full. 50,000 distinct reads went from 2.3 s to 0.2 s.Fixes
registerChunks()andunregisterChunks()merge into the stored registry, andsetCleanupService()is deprecated.lazy_loadingoff now applies to existing entries.materialize()keeps the collection class (for exampleEloquent\Collection).LazyChunkedCollectionisJsonSerializable.slice()accepts negative arguments.put()throw while it measures, hashes for dedup, or sizes the value for chunking.store('x')->refreshAsync()andasyncSwr()write to storex, not the default store.flushNamespace()starts from the stored index.Carbon::setTestNow()andtravel()work as they do with Laravel'sCache::flexible().clear --forcenow clears non-managed keys when every managed key had expired.'123') are recognized byclear,status, and the dashboard's clear command.clear --forcecontinues past a key it cannot read.warmwarns about unknown warmer names.remember().getStats(): recovery time and a staleopened_at.Security (opt-in)
smart-cache.serializable_classesapplies Laravel's unserialize class restriction to the values SmartCache compresses, encrypts, or serializes itself; Laravel'scache.serializable_classesnever reached them. Set it to'cache'to follow Laravel's setting, tofalse, or to a list of allowed classes.It is opt-in on purpose. The Laravel 13 application skeleton sets
cache.serializable_classes => false, so honoring it by default would turn large cached objects into__PHP_Incomplete_Classfor apps that rely on today's behavior.Upgrade notes (also in CHANGELOG)
store('name')by 1.17 but run by a 1.16 worker still writes to the default store. The worker ignores the new job property; I verified this on Laravel 8 and 13. Upgrade workers with or before web servers.clear --forcenow also clears non-managed keys when every managed key had expired.materialize()returns the collection subclass.flushPatterns()andinvalidateModel()count overlapping matches once.lazy_loadingwas turned off, entries written while it was on now come back eagerly.json_encode()of a lazy collection now gives a list instead of{}.flushNamespace()reads the index first and also flushes keys other processes tracked.Left out on purpose (need a decision)
resolved(). It would skip building the singleton on requests that never use it. Under Octane it changes which container instance getsreset(), and I couldn't test that here.smart_sizing. On Redis or the file store it would split today's single chunk into many, which means more round trips per read._sc_only as a key prefix in the console commands.clear --forcewould then delete user keys that merely contain_sc_.Type of change
How Has This Been Tested?
vendor/bin/phpunitpasses: 725 tests, 2,611 assertions, with the 2 skips that were already there (678 before).tests/Unit/V117FixesTest.phpadds 47 tests. All 37 non-guard tests fail on 1.16.0; I checked this by running the file against the 1.16 source.CostAwareCacheManager::refresh(), so it can't run there.Test Configuration:
Checklist:
Reviews
SmartCache.phpmyself. I reproduced every finding before adopting it. The ones that would change behavior are under "Left out on purpose".renderDashboard()still receivestatisticsandhealth.chunk_sizeitems. Fixed.laravel/laravelskeleton to check theserializable_classesdefault. I had checked it: 13.xconfig/cache.phpships'serializable_classes' => false, and the docs now cite the skeleton.cache_lockstable, whatclear --forcedeletes, the full internal-key list, and PHP 8.5 in TESTING.md.Docs
docs/index.htmlgains a "New in 1.17.0" note, an upgrade section, and updates to the lazy loading, encryption and deserialization, queued refresh, dashboard, workers, and config reference sections.1.17.0, plus the missing 1.15/1.16/1.17 compare links), SECURITY.md (maintained line 1.17.x), TESTING.md (test counts, PHP 8.5), and the config comments.Generated by Claude Code