You can have a dedicated memcached at your hosting account for your websites cache and other special needs.
The memcached will be a private daemon, and accessed through linux socket, so no others users will have access to your data.
You need a paid hosting plan to have access to this resources.
Create a cron job to start the memcached
Just insert this line at your cronjobs, inside cPanel, to run at every minute:
/usr/local/cpanel/3rdparty/bin/dmcached.sh >/dev/null 2>&1
To verify the statistics of your memcached, run this at your shell (ssh):
# /usr/local/cpanel/3rdparty/bin/dmcached.sh stats
The default memcached has 32MB of memory, if you need more, just add the memory parameter like this:
/usr/local/cpanel/3rdparty/bin/dmcached.sh 64 >/dev/null 2>&1
And stop the actual daemon, so the cron can start the new one with the new memory. At shell:
# /usr/local/cpanel/3rdparty/bin/dmcached.sh stop
How to use memcached with unix socket?
It is basicaly the same of network access, with other URL.
The URL will be:
At port, use:
For example, here is how to enable memcached at mediawiki LocalSettings.php:
// MEMCACHED $wgMainCacheType = CACHE_MEMCACHED; $wgParserCacheType = CACHE_MEMCACHED; # optional $wgMessageCacheType = CACHE_MEMCACHED; # optional $wgMemCachedServers = array("unix:///home/REPLACE-YOUR-USER-HERE/.memcache/memcached.sock:0"); $wgSessionsInObjectCache = true; # optional $wgSessionCacheType = CACHE_MEMCACHED; # optional
How can I see my value of “REPLACE-YOUR-USER-HERE”?
At shell login (ssh) just enter: # pwd , and you will see /home/YOUR-USER-HERE
Why I cant access memcached at default URL?
The URL 127.0.0.1:11211 is insecure if used at shared hosting, because all users can read and write at same memcached servers and data.
Here you have a very secure solution: unix socket inside cloudLinux with cageFS.