Skip to content

Commit

Permalink
Merge pull request #123 from froschdesign/hotfix/docs/10
Browse files Browse the repository at this point in the history
Update caching documentation for laminas-cache
  • Loading branch information
gsteel authored Jul 2, 2024
2 parents f09a48c + 94b57cc commit d6c05e1
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 d6c05e1

Please sign in to comment.