Memcached integration

This commit is contained in:
Naveenkumar Seetimani Seetimani 2022-11-01 14:15:34 +05:30
parent 4828defc52
commit 5144ca8045
3 changed files with 21 additions and 0 deletions

View File

@ -25,5 +25,8 @@ services:
MYSQL_ROOT_PASSWORD: secret
MYSQL_DATABASE: todos
cacheserver:
image: memcached
volumes:
dbvolume:

View File

@ -8,6 +8,8 @@ RUN apt-get install -y graphviz aspell clamav
RUN apt-get install -y libxml2-dev
RUN apt-get install -y libzip-dev
RUN apt-get install -y libpng-dev
RUN apt-get install -y libmemcached-dev
RUN printf "\n" | pecl install memcached
RUN docker-php-ext-install soap
RUN docker-php-ext-install zip
@ -24,3 +26,4 @@ RUN docker-php-ext-enable gd
RUN docker-php-ext-enable xmlrpc
RUN docker-php-ext-enable mysqli
RUN docker-php-ext-enable pdo_mysql
RUN docker-php-ext-enable memcached

View File

@ -12,5 +12,20 @@ if ($conn->connect_error) {
echo "Connected successfully";
$memcached = new Memcached();
$memcached->addServer('cacheserver', 11211);
$response=$memcached->get("sample_key");
if($response) {
echo $response;
echo "\n";
}
else {
echo "Cache is empty\n";
$memcached->set("sample_key", "New data set for cache\n");
}
//echo phpinfo();
?>