Skip to content

Commit

Permalink
Update caching documentation for laminas-cache
Browse files Browse the repository at this point in the history
Fixes #10

Signed-off-by: Frank Brückner <[email protected]>
  • Loading branch information
froschdesign committed May 18, 2024
1 parent b3259ac commit 94b57cc
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions docs/book/translator/caching.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ guarantees an optimized loading procedure.
> ```bash
> $ composer require laminas/laminas-cache-storage-deprecated-factory
> ```
>
> laminas-cache is shipped without a specific cache adapter to allow free choice of storage backends and their dependencies.
> So make sure that the required adapters are installed.
>
> The following example used the [memory adapter of laminas-cache](https://docs.laminas.dev/laminas-cache/storage/adapter/#memory-adapter):
>
> ```bash
> $ composer require laminas/laminas-cache-storage-adapter-memory
> ```
## Enable Caching
Expand All @@ -26,10 +35,7 @@ method.
$translator = new Laminas\I18n\Translator\Translator();
$cache = Laminas\Cache\StorageFactory::factory([
'adapter' => [
'name' => Laminas\Cache\Storage\Adapter\Filesystem::class,
'options' => [
'cache_dir' => __DIR__ . '/cache',
],
'name' => Laminas\Cache\Storage\Adapter\Memory::class,
],
]);
$translator->setCache($cache);
Expand Down

0 comments on commit 94b57cc

Please sign in to comment.