Memcached integration
This commit is contained in:
parent
4828defc52
commit
5144ca8045
|
@ -25,5 +25,8 @@ services:
|
|||
MYSQL_ROOT_PASSWORD: secret
|
||||
MYSQL_DATABASE: todos
|
||||
|
||||
cacheserver:
|
||||
image: memcached
|
||||
|
||||
volumes:
|
||||
dbvolume:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue