phalcon/incubator-annotations

Phalcon 孵化器注解

v1.0.0 2021-03-28 13:56 UTC

This package is auto-updated.

Last update: 2024-09-19 22:40:27 UTC


README

此处提供适配器的使用示例

Memcached

将解析后的注解存储到Memcached中。此适配器使用Phalcon\Cache\Adapter\Libmemcached后端存储缓存内容

use Phalcon\Incubator\Annotations\Adapter\Memcached;

$di->set(
    'annotations',
    function () {
        return new Memcached(
            [
                'lifetime' => 8600,
                'host'     => 'localhost',
                'port'     => 11211,
                'weight'   => 1,
                'prefix'   => 'prefix.',
            ]
        );
    }
);

Redis

将解析后的注解存储到Redis中。此适配器使用Phalcon\Cache\Adapter\Redis后端存储缓存内容

use Phalcon\Incubator\Annotations\Adapter\Redis;

$di->set(
    'annotations',
    function () {
        return new Redis(
            [
                'lifetime' => 8600,
                'host'     => 'localhost',
                'port'     => 6379,
                'prefix'   => 'annotations_',
            ]
        );
    }
);