Framework

Repository Author Commit message Committed SHA  
 
caching by dg updated upgrading.md
caching by xificurk Cache: callbacks of load(), bulkLoad() and call() are marked as immediately invoked (#87)

PHPStan then attributes checked exceptions thrown by the callback to the caller.

caching by dg added Dependencies, the typed form of the dependency array (BC break)

A generator whose parameter is typed Dependencies gets the object, any other
keeps the array by reference. load(), save(), bulkSave(), wrap() and
OutputHelper::end() accept the object as well. An array is converted to it, so
an unknown key, a condition of clean() given as a dependency or a value of a
wrong type now throws instead of reaching the storage. Storages still get the
array.

540d3379-98ae-4924-88b3-ede8cf5a00f0

caching by dg added Psr16Storage: any PSR-16 cache can be used as Nette cache storage
caching by dg RedisStorage: prevents cache stampede by a lock with a timeout

A missing item is generated by one process, the others poll until it appears.
The lock expires after $lockTimeout seconds (30 by default), so a crashed process
does not block the item, and is released only by the process still holding it.

540d3379-98ae-4924-88b3-ede8cf5a00f0

caching by dg added RedisStorage with native support for tags, priorities and namespace cleaning
caching by dg Storage::lock() replaced by optional LockingReader::readOrGenerate() (BC break)

The lock spanned two calls, lock() and the write() or remove() releasing it,
so a network storage could not implement it safely. Now the storage runs the
generator of Cache::load() under its own lock and releases it in finally.

FileStorage reads the item again under the lock, so a process that found it
missing while another was generating it no longer generates it a second time.
A failed generator or a missing journal leaves no empty file behind, and a
generator generating its own item throws instead of waiting forever for the lock
of its own process.

Cache::save() with a closure is deprecated, it runs the closure without a lock.

540d3379-98ae-4924-88b3-ede8cf5a00f0

caching by dg Cache::clean(all: true) on a Cache with namespace removes only its namespace (BC break)

It removed the items of all namespaces, contrary to the isolation a namespace
promises. Now it removes the namespace together with those derived from it;
only a Cache without a namespace clears the entire storage, which is also
available through Storage::clean([Cache::All => true]). MemcachedStorage cannot
clean a namespace, so there it throws NotSupportedException instead of flushing
the whole server.

caching by dg Cache::clean() without any condition throws instead of collecting garbage (BC break)

The call reads as clearing the cache, yet it passed an empty array to the
storage, which FileStorage and SQLiteStorage take as a request to remove expired
items and the others ignore. Garbage collection stays available through
Storage::clean([]).

caching by dg Cache::clean() validates the array of conditions (BC break)

The array is converted to the named arguments, so an unknown key or a
dependency such as Cache::Expire throws InvalidArgumentException and a value of
a wrong type, such as a numeric string priority, throws TypeError instead of
reaching the storage, where an unknown key was silently ignored. A single tag or
namespace is still accepted and wrapped into a list.

caching by dg Cache::clean() accepts conditions as named arguments

$cache->clean(tags: [...]) and likewise priority, namespaces and all replace
the array with Cache::* keys, which stays supported; the two forms cannot be
combined in one call. An empty list of tags or namespaces is a condition that
matches nothing, so the call returns without reaching the storage. The
deprecated UPPERCASE constants of the conditions point to the new form.

caching by dg MemoryStorage: supports cleaning by Cache::Namespaces

It silently ignored the condition, so cleaning a namespace kept its items.
Like the other storages, it removes the nested namespaces too.

caching by KminekMatej MemoryStorage: supports Expire, Sliding, Tags and Priority dependencies (#85)
caching by dg FileStorage: serialization of data can be changed by overriding serializeData() and unserializeData() [Closes #82]
caching by dg FileStorage: the constructor runs a garbage collector batch limited in time instead of walking the whole cache
caching by dg MemcachedStorage: a failed write triggers a warning instead of being silently ignored [Closes #71]
caching by dg storages throw NotSupportedException for unsupported dependencies instead of silently ignoring them (BC break)
caching by Jirka F SQLiteStorage: added support for cleaning namespace
caching by dg FileStorage: cleaning by Cache::Namespaces includes the namespaces derived from it (BC break)

It removed only the items of the namespace itself and left those of the nested
namespaces created by derive(). A namespace now goes away as a whole.

caching by dg SQLiteStorage: WAL mode for better concurrency of readers and writers
caching by dg PsrCacheAdapter: validates cache keys as required by PSR-16 (BC break)
caching by dg PsrCacheAdapter: getMultiple() takes advantage of bulk reading
caching by dg requires Latte 3.1
caching by dg used #Deprecated
caching by dg Storage::read() added return typehint (BC break)
caching by dg removed legacy services names
caching by dg removed compatibility for old class names
caching by dg used PHP 8.4 features
caching by dg requires PHP 8.4
caching by dg composer: requires nette/utils 4.1
caching by dg opened 4.0-dev
caching by dg updated docs

Last synchronization: 2026-11-07 16:02:44