Repository navigation
WinCache Handler
⚠️ Deprecated. The WinCache extension is no longer a supported Microsoft product and has no stable release for PHP 8; only an unsupported beta (2.0.0.9, best-effort maintenance) builds on PHP 8.1 and later. This handler is kept only for backward compatibility. On any modern stack use File, Redis or Memcache(d) instead.
InitPHP\Cache\Handler\Wincache stores items in the WinCache user cache
(ext-wincache, Windows only).
| Option | Type | Default | Description |
|---|---|---|---|
prefix |
string |
cache_ |
Prepended to keys. |
default_ttl |
int |
0 |
Expiry used when set() is called without a TTL. 0 = no expiry. |
use InitPHP\Cache\Cache;
use InitPHP\Cache\Handler\Wincache;
$cache = Cache::create(Wincache::class, [
'default_ttl' => 300,
]);
$cache->set('key', 'value', 60);
$cache->get('key');- Values are stored with
wincache_ucache_set(); TTLs are delegated to WinCache. - When
set()is called without a TTL, thedefault_ttloption is applied (0= no expiry). -
has()useswincache_ucache_exists(). -
clear()callswincache_ucache_clear(), which clears the entire user cache — it is not limited byprefix.
The handler is only supported when the extension is loaded and the user cache is enabled:
extension_loaded('wincache') && ini_get('wincache.ucenabled'); // must be trueConstructing the handler in an unsupported environment throws a
CacheException — which is what you will get on any runtime
where the extension is not installed and enabled (there is no stable WinCache
release for PHP 8). Build a different handler instead.
- File Handler — the zero-dependency replacement.
- Configuration Options — all handlers side by side.
initphp/cache · MIT License · part of the InitPHP family
Source · Issues · Discussions · Packagist · Contributing · Security Policy
Getting Started
Core Concepts
Handlers
Guides
Other