Lua – Simple method to use Memcache

Published on Author gryzliLeave a comment

If you need fast and lightweight method of connecting with Memcache daemon, you can do it by just using the ‘socket’ module and open a TCP connection to the Memcache daemon. 

After you have your connection done to Memcache, you could issue all kind of commands for getting/storing information. 




The following piece of code (checkInMemcache) , could be used to make a simple check if a given key string exists in your Memcache. 

This could be easily extended to whatever your need is (setting,getting keys …). 



You are going to need at least lua “socket” library in order to use this function. 

If you are using Centos, you can get ‘socket’ by installing the package: lua-socket



Leave a Reply

Your email address will not be published. Required fields are marked *

Captcha * Time limit is exhausted. Please reload CAPTCHA.