Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
voku committed Feb 24, 2019
1 parent 436a823 commit 8941e02
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions README.md
Expand Up @@ -107,21 +107,41 @@ activate the "$cacheAdapterManagerForAutoConnectOverwrite" option in the "Cache"
you can implement your own cache auto-detect logic.

```php
use voku\cache\Cache;

$cacheManager = new CacheAdapterAutoManager();
$cacheManager = new \voku\cache\CacheAdapterAutoManager();

// 1. check for "APCu" support first
$cacheManager->addAdapter(
\voku\cache\AdapterApcu::class
);

// 2. try "File"-Cache + OpCache
$cacheManager->addAdapter(
AdapterOpCache::class,
\voku\cache\AdapterOpCache::class,
static function () {
$cacheDir = \realpath(\sys_get_temp_dir()) . '/simple_php_cache_new';

return $cacheDir;
}
);

// 3. use Memory Cache as final fallback
$cacheManager->addAdapter(
AdapterArray::class
\voku\cache\AdapterArray::class
);

$cache = new \voku\cache\CachePsr16(
null, // use auto-detection
null, // use auto-detection
false, // do not check for usage
true, // enable the cache
false, // do not check for admin session
false, // do not check for dev
false, // do not check for admin session
false, // do not check for server vs. client ip
'', // do not use "_GET"-parameter for disabling
$cacheManager, // new auto-detection logic
true // overwrite the auto-detection logic
);
```

Expand Down

0 comments on commit 8941e02

Please sign in to comment.