# Laminas-cache example not working

**URL:** <https://discourse.laminas.dev/t/laminas-cache-example-not-working/3087>\
**Category:** Components & MVC\
**Tags:** laminas-cache\
**Created:** [October 25, 2022, 9:55am UTC](https://discourse.laminas.dev/t/laminas-cache-example-not-working/3087 "2022-10-25T09:55:49Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![froschdesign](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/froschdesign/32/38_2.png) [@froschdesign](https://discourse.laminas.dev/u/froschdesign)\
**Post date:** [October 25, 2022, 11:06am UTC](https://discourse.laminas.dev/t/laminas-cache-example-not-working/3087/4 "2022-10-25T11:06:04Z")

</div>

> [@wiryonolau](#):
>
> So It can only be call using **configure**?

No, there are many ways but via the config provider class it is easy, because no manual configuration is needed. Make sure you added laminas-cache and the cache adapter to your service container:

```php
$container = new Laminas\ServiceManager\ServiceManager();

// Add everything from laminas-cache
$container->configure(
    (new Laminas\Cache\ConfigProvider())->getDependencyConfig()
);

// Add everything from the filesystem adapter of laminas-cache
$container->configure(
    (new Laminas\Cache\Storage\Adapter\Filesystem\ConfigProvider())->getServiceDependencies()
);

```

See also:

> [@I am new to Laminas, I need to know how Cache works](https://discourse.laminas.dev/t/i-am-new-to-laminas-i-need-to-know-how-cache-works/2925/2):
>
> Hello and welcome to our forums! smiley Before starting, make sure a cache adapter is installed, like the APCu or the Filesystem adapter. Here is an example which uses two different cache adapters as storage for the cache: require\_once \_\_DIR\_\_ . '/vendor/autoload.php'; $config = (new Laminas\ConfigAggregator\ConfigAggregator([ Laminas\Cache\ConfigProvider::class, Laminas\Cache\Storage\Adapter\BlackHole\ConfigProvider::class, Laminas\Cache\Storage\Adapter\Memory\ConfigProvider:…

> [@wiryonolau](#):
>
> Wouldn’t it be better if cache adapter use Module.php and ConfigProvider.php style like the rest of the library ?

That is already being done.

---

_[View the full topic](https://discourse.laminas.dev/t/laminas-cache-example-not-working/3087)._
