1. Go to this page and download the library: Download ienaga/phalcon-redis-plugin library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ienaga / phalcon-redis-plugin example snippets
$loader = new Phalcon\Config\Adapter\Yaml\Loader();
return $loader
->setIgnore(["routing"]) // ignore yml names
->setEnvironment("stg") // default dev
->setBasePath(realpath(dirname(__FILE__) . "/../.."))
->load();
/**
* Database connection is created based in the parameters defined in the configuration file
*/
$dbService = new \Phalcon\Mvc\Model\Adapter\Redis\Service();
$dbService->registration();
/**
* If the configuration specify the use of metadata adapter use it or use memory otherwise
*/
$di->setShared('modelsMetadata', function () {
return new \Phalcon\Mvc\Model\Adapter\Redis\Metadata\Redis(
$this->getConfig()
->get("redis")
->get("metadata")
->toArray()
);
});