# Activation of Memcached

**URL:** <https://forum.getkirby.com/t/activation-of-memcached/3911>\
**Category:** Questions\
**Tags:** v2\
**Created:** [April 20, 2016, 6:21am UTC](https://forum.getkirby.com/t/activation-of-memcached/3911 "2016-04-20T06:21:37Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![jensfranke](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jensfranke/32/722_2.png) [@jensfranke](https://forum.getkirby.com/u/jensfranke)\
**Post date:** [April 20, 2016, 6:21am UTC](https://forum.getkirby.com/t/activation-of-memcached/3911/1 "2016-04-20T06:21:37Z")

</div>

Hi, I installed Memcached as Daemon (Version 1.4.25) and I also add the extension via php.ini (Version 2.2.7).

My config looks like this:

```auto
c::set('cache', true);
c::set('cache.driver', 'memcached');

```

But I still get an error `(Fatal error: Class 'Memcached' not found)`.

Does anyone has an idea?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![lukasbestle](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/lukasbestle/32/11437_2.png) [@lukasbestle](https://forum.getkirby.com/u/lukasbestle)\
**Post date:** [April 20, 2016, 12:54pm UTC](https://forum.getkirby.com/t/activation-of-memcached/3911/2 "2016-04-20T12:54:14Z")

</div>

Does the memcached extension show up in your `phpinfo`? Please note that there is a `Memcache` and a `Memcached` extension. Kirby requires the latter.

---

<div class="post-metadata">

**Author:** ![jensfranke](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jensfranke/32/722_2.png) [@jensfranke](https://forum.getkirby.com/u/jensfranke)\
**Post date:** [April 20, 2016, 3:06pm UTC](https://forum.getkirby.com/t/activation-of-memcached/3911/3 "2016-04-20T15:06:47Z")

</div>

Ah, I didn’t know that two libraries extensions are available. I hope I can activate / install them at Domainfactory. So Extension is the way and not the Daemon, right?

---

<div class="post-metadata">

**Author:** ![lukasbestle](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/lukasbestle/32/11437_2.png) [@lukasbestle](https://forum.getkirby.com/u/lukasbestle)\
**Post date:** [April 20, 2016, 3:45pm UTC](https://forum.getkirby.com/t/activation-of-memcached/3911/4 "2016-04-20T15:45:47Z")

</div>

No, you still need the daemon. What I meant is that there are two different extensions, but you need the `memcached` one (_with_ the d at the end) specifically.

---

<div class="post-metadata">

**Author:** ![jensfranke](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jensfranke/32/722_2.png) [@jensfranke](https://forum.getkirby.com/u/jensfranke)\
**Post date:** [April 21, 2016, 7:44pm UTC](https://forum.getkirby.com/t/activation-of-memcached/3911/5 "2016-04-21T19:44:04Z")

</div>

Thanks! Now I got it.

---

<div class="post-metadata">

**Author:** ![jensfranke](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jensfranke/32/722_2.png) [@jensfranke](https://forum.getkirby.com/u/jensfranke)\
**Post date:** [April 22, 2016, 5:52am UTC](https://forum.getkirby.com/t/activation-of-memcached/3911/6 "2016-04-22T05:52:21Z")

</div>

@lukasbestle Sorry, next question. memcache **d** is activated:

```auto
Version	2.2.0
libmemcached version	1.0.18

```

cache is true and my cache-folder is `site/cache`. With the cache-driver »file« for each a new file is added to the cache-folder, but not with memcached. Maybe it is a stupid question, but how can I verify that memcached is working correctly?

---

<div class="post-metadata">

**Author:** ![lukasbestle](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/lukasbestle/32/11437_2.png) [@lukasbestle](https://forum.getkirby.com/u/lukasbestle)\
**Post date:** [April 22, 2016, 9:47am UTC](https://forum.getkirby.com/t/activation-of-memcached/3911/7 "2016-04-22T09:47:14Z")

</div>

The `memcached` cache driver does not store anything in the `site/cache` directory, that’s the whole point. 😉

You can test if it works by storing something in the cache and then retrieving it in another request:

```php
kirby()->cache()->set('test', 'my test data');

dump(kirby()->cache()->get('test'));

```

---

<div class="post-metadata">

**Author:** ![jensfranke](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jensfranke/32/722_2.png) [@jensfranke](https://forum.getkirby.com/u/jensfranke)\
**Post date:** [April 22, 2016, 10:16am UTC](https://forum.getkirby.com/t/activation-of-memcached/3911/8 "2016-04-22T10:16:07Z")

</div>

> The memcached cache driver does not store anything in the site/cache directory, that’s the whole point.

Haha, got it. 😉

> kirby()-\>cache()-\>set(‘test’, ‘my test data’);  
> dump(kirby()-\>cache()-\>get(‘test’));

Works fine, thanks! Two additional questions:

1. If you change anything via panel the complete cache is rebuild or only the part (page) which was changed?

2. If I change anything directly in the templates I should call `kirby()->cache()->flush()` via an api for example to see the changes, right?

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [April 22, 2016, 10:26am UTC](https://forum.getkirby.com/t/activation-of-memcached/3911/9 "2016-04-22T10:26:14Z")

</div>

> [@jensfranke](#):
>
> If you change anything via panel the complete cache is rebuild or only the part (page) which was changed?

The complete cache is flushed, because a change in one page might also affect other parts of the website.

---

<div class="post-metadata">

**Author:** ![jensfranke](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jensfranke/32/722_2.png) [@jensfranke](https://forum.getkirby.com/u/jensfranke)\
**Post date:** [April 22, 2016, 10:32am UTC](https://forum.getkirby.com/t/activation-of-memcached/3911/10 "2016-04-22T10:32:30Z")

</div>

Perfect. Thanks for your help!

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [February 6, 2025, 4:59pm UTC](https://forum.getkirby.com/t/activation-of-memcached/3911/11 "2025-02-06T16:59:42Z")

</div>

Archived on February 6, 2025, 4:59pm UTC


