Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

How to enable memcached

  • SvenFlock
  • SvenFlock's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 1 month ago #193413 by SvenFlock
How to enable memcached was created by SvenFlock
Hi,

I found the following information at the setup guide that it is possible to enable memcached for LimeSurvey:

LimeSurvey uses the Yii file cache by default, but it can be configured to use other cache engines. Possible other caches are:

Memcached
Redis
WinCache
XCache
Please see the Yii documentation for full description.


I have fully installed and configured memcached on my server. However, I do not find any details in the documentation how to use that cache in LimeSurvey.

Can you tell me how to switch from Yii to memcached?


Thanks
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 1 month ago #193417 by Joffm
Replied by Joffm on topic How to enable memcached
I think you will find something here
www.yiiframework.com/doc/guide/2.0/en/caching-data

In LimeSurvey have a look at "framework/caching/CMemCache.php" and of course "config.php".

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: DenisChenu
The topic has been locked.
More
4 years 1 month ago #193420 by jelo
Replied by jelo on topic How to enable memcached
LimeSurvey (even 4.0) still uses Yii1.1 which can differ from Yii2.0
www.yiiframework.com/doc/guide/1.1/en/

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • SvenFlock
  • SvenFlock's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 1 month ago #193422 by SvenFlock
Replied by SvenFlock on topic How to enable memcached
Thanks,

didn't know that is is part of the Yii. I have never worked with it before and I am not a PHP coder.

I looked at the CMemCache.php file and set

public $useMemcached=true;

However, I do not know where to set the servers.

www.yiiframework.com/doc/api/1.1/CMemCache shows an array definition. But I don't know where to insert it. On first look, it doesn't look like PHP syntax.

A few lines lower, there is some fallback if no servers have been found that it will use localost:

$cache->addServer('localhost',11211);

As grep tells me that memcached is running on that port

root 21918 0.0 0.0 12712 928 pts/1 S+ 08:43 0:00 grep memcached
memcache 22441 0.0 0.0 348996 15408 ? Ssl Feb02 0:20 /usr/bin/memcached -m 512 -p 11211 -u memcache -l 127.0.0.1

I can assume that is now working?

Is there a log or an endpoint to check if the config works and memcached is currently used?
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 1 month ago #193425 by Joffm
Replied by Joffm on topic How to enable memcached
Did you consider this in CMemCache.php?

To use CMemCache as the cache application component, configure the application as follows,

IMO you have to add this to your config.php.

Otherwise your hardcoded setting in CMemCache.php will be overwritten with each update.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 1 month ago - 4 years 1 month ago #193445 by DenisChenu
Replied by DenisChenu on topic How to enable memcached
www.yiiframework.com/doc/api/1.1/CMemCache

You can add this in your config.php file …

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 4 years 1 month ago by DenisChenu.
The topic has been locked.
  • SvenFlock
  • SvenFlock's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 1 month ago #193465 by SvenFlock
Replied by SvenFlock on topic How to enable memcached
So I just copy the array definition the config.php at any place?
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 1 month ago #193468 by DenisChenu
Replied by DenisChenu on topic How to enable memcached

SvenFlock wrote: So I just copy the array definition the config.php at any place?

YOU must setup memcached before,
github.com/memcached/memcached/wiki/TutorialCachingStory

But here : it's not LimeSurvey related question …

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
More
4 years 1 month ago #193482 by jelo
Replied by jelo on topic How to enable memcached

DenisChenu wrote: YOU must setup memcached before,
github.com/memcached/memcached/wiki/TutorialCachingStory

Did you read the starting post?

I have fully installed and configured memcached on my server.


Many users stumble when the configfiles have arrays.

The question is where and how to place the memcached settings array inside config.php
Code:
* array(
 *     'components'=>array(
 *         'cache'=>array(
 *             'class'=>'CMemCache',
 *             'servers'=>array(
 *                 array(
 *                     'host'=>'server1',
 *                     'port'=>11211,
 *                     'weight'=>60,
 *                 ),
 *                 array(
 *                     'host'=>'server2',
 *                     'port'=>11211,
 *                     'weight'=>40,
 *                 ),
 *             ),
 *         ),
 *     ),
 * )


To reframe the question: Can anybody provide a LimeSurvey config.php example where memcached is used via Yii?

I don't use memcached, so I won't feel qualified to provide a tested working example.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 1 month ago #193484 by DenisChenu
Replied by DenisChenu on topic How to enable memcached

jelo wrote:

DenisChenu wrote: YOU must setup memcached before,
github.com/memcached/memcached/wiki/TutorialCachingStory

Did you read the starting post?

I have fully installed and configured memcached on my server.

Yes,

But when reading

So I just copy the array definition the config.php at any place?

I think user must review the installation … he must know the port, the server etc …

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
More
4 years 1 month ago #193488 by jelo
Replied by jelo on topic How to enable memcached

DenisChenu wrote:

So I just copy the array definition the config.php at any place?

I think user must review the installation … he must know the port, the server etc …


The only question I see is where to place the memcached array inside the config.php generated by LimeSurvey.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 1 month ago #193489 by DenisChenu
Replied by DenisChenu on topic How to enable memcached
manual.limesurvey.org/Optional_settings#Yii_settings

It's in manual … and … who add this part ?

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose