-
Notifications
You must be signed in to change notification settings - Fork 0
WinCache Handler
⚠️ Deprecated. The WinCache extension is unmaintained and is not available for PHP 8. 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, since the extension does not exist on
PHP 8, is what you will get on any current runtime. 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