Loading...
 

Memcached

Memcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database calls, API calls, or page rendering.
Tiki has a feature to connect to memcached servers to store temporary information.

Installation

Memcached works on most Linux and BSD like systems. There is no official support for windows builds.
Generally, you should install memcached from a package provided by your operating system. The OS will solve dependencies for you and take care of security updates.

For Debian or Ubuntu
sudo apt-get install memcached

For Redhat/Fedora
yum install memcached


See the documentation for your OS's package management system for more information.
Memcached depends on libevent. If you're running an OS installed after 2010 the package provided by your OS should be good enough.

For Debian or Ubuntu
sudo apt-get install libevent-dev

For Redhat/Fedora
yum install memcached


If desired, you can build from source as well.

Build from source
wget https://memcached.org/latest
[you might need to rename the file]
tar -zxf memcached-1.x.x.tar.gz
cd memcached-1.x.x
./configure --prefix=/usr/local/memcached
make && make test && sudo make install


To prevent memcached servers for vulnerabity to DDOS attack, make sure to disable APP support if you do not need it. UDP is disabled by default on versions 1.5.6 and later.
It can be disabled by adding -U 0 to your start arguments while starting memcached server .
If you use a config file,you can disable UDP by adding the following line to your /etc/memcached.conf:

/etc/memcached.conf
# Disable UDP protocol
-U 0

Save /etc/memcached.conf and restart the service.

For Debian or Ubuntu
sudo service memcached restart


Then you need to install memcached php extension in order to interact with the memcached server from tiki instance.

You need to know witch php

In case you dont have any precision about the version, execute the command on CLI on your instance, and make sure Tiki-manager services is activated.

console
console.php manager:instance:detect
version your Tiki instance is running on, in case you have multiple version of php on your server.

From version 26.0, Tiki is running on php8.1, and above version on php7.4 until version 22.

Tiki running on php8.1
sudo apt-get install php8.1-memcached


Restart apache services

For Debian or Ubuntu
sudo systemctl restart apache2


Then you are, everything is ready to work with memcached on Tiki, consider advanced mode is enabled on your tiki instance in order to see memcache menu content.

How to Install Memcached On Windows

As mention before There is no official support for windows builds, but there some built that can be used just for devellopement.
so few step are required in order to work with memcached on windows.

  • Download a stable version, in either Memcahed 64bit or 32bit.
  • Create a directory such as "c:\memcached\" (or something else)
  • Extract the .zip content to that directory. There should be one "memcached.exe" file, and a couple of other files.
  • Open a command prompt (should be opened as administrator). Type the command
To start the service
c:\memcached\memcached.exe -d start
To stop the service
c:\memcached\memcached.exe -d stop


By default the pool memoy size is 64Mb, but if you want to change the memory pool size to 512MB,

To change the memory pool size
c:\memcached\memcached.exe -m 512


Your Memcached service should now run and wait incoming key/value pairs.

IMPORTANT NOTES:

  1. You can download memcache php extension and made some modifications of the php.ini configuration file.
  2. To have Memcached started as a Windows Service in the control panel after a reboot.
To stop the service
c:\memcached\memcached.exe -d install

But if you choose to install it as a service, you lose the ability to change the pool size via command line. You will need to edit a registry key as follows:

Launch regedit and Find “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\memcached
Edit the “–m VALUE” to the number of desired megabytes “–m 512” = 512 MB

Caution

In case the memcache menu does not display content, you will need to clean your instance cache, and for unexpected case you will be require to reboot your server.

For more detail you can check:
Memcached wiki installation
Memcached DDOS
Windows release