mheap / silex-memcache
Memcache extension for Silex
Installs: 83 238
Dependents: 2
Suggesters: 0
Security: 0
Stars: 26
Watchers: 3
Forks: 8
Open Issues: 0
Requires
- php: >=7.0
Requires (Dev)
- phpunit/phpunit: ^6.3
- silex/silex: 2.*
- squizlabs/php_codesniffer: ^3.1
This package is auto-updated.
Last update: 2020-11-26 18:12:43 UTC
README
Requirements
This extension only works with PHP 7.1+, Silex 2 and the Memcached driver. Version 1.0.0 is compatible with Silex 1 and both the Memcache/Memcached drivers.
Installation
Install with composer:
composer require mheap/silex-memcache
Usage
Before you can use this extension you need to register it with your application. You can specify a list of servers to connect to at this point
$app->register(new SilexMemcache\MemcacheExtension(), array( 'memcache.server' => array( array('127.0.0.1', 11211) ) ));
Once the extension is registered, it'll be available as $app['memcache']
:
$app->get('/', function() use($app) { $app['memcache']->set('my_value', 'This is an example'); $value = $app['memcache']->get('my_value'); });
Running the tests
You'll need memcached running on port 11211
locally to run the tests. If you don't have
memcached installed you can run docker-compose up
to run it in a container instead.