承接 rollerworks/uri-encoder-doctrine-cache 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

rollerworks/uri-encoder-doctrine-cache

最新稳定版本:v1.0.0

Composer 安装命令:

composer require rollerworks/uri-encoder-doctrine-cache

包简介

Provides a Doctrine Cache adapter for the Rollerworks URIEncoder Component

关键字:

README 文档

README

This package provides a Doctrine Cache adapter for the Rollerworks URIEncoder Component.

Installation

To install this package, add rollerworks/uri-encoder-doctrine-cache to your composer.json

$ php composer.phar require rollerworks/uri-encoder-doctrine-cache

Then, you can install the new dependencies by running Composer's update command from the directory where your composer.json file is located:

$ php composer update rollerworks/uri-encoder-doctrine-cache

Now, Composer will automatically download all required files, and install them for you.

Usage

require 'vendor/autoload.php';

use Doctrine\Common\Cache\ArrayCache;
use Doctrine\Common\Cache\ChainCache;
use Rollerworks\Component\UriEncoder\Encoder as UriEncoder;
use Rollerworks\Component\UriEncoder\Cache\DoctrineCache;

// The Doctrine cache library.
$doctrineCache = new ChainCache(
    [
        // Include the ArrayCache as the ChainCache will populate all the previous cache layers.
        // So if the `FilesystemCache` has a match it will populate the faster ArrayCache.
        new ArrayCache(),

        // Add an simple cache for fast access, eg. the rollerworks session-cache library.
        // https://github.com/rollerworks/Cache
    ]
);

// Rollerworks\Component\UriEncoder\CacheAdapterInterface
$cacheDriver = new DoctrineCache($doctrineCache);

$stringEncode = 'This string is not safe, for direct usage & must encoded';

$base64Encoder = new UriEncoder\Base64UriEncoder();
$cacheEncoder = new UriEncoder\CacheEncoderDecorator($cacheDriver, $base64Encoder);

$safeValue = $cacheEncoder->encodeUri($stringEncode);

// $safeString now contains a base64 encoded string
// and the result is cached using the cacheDriver.

$originalValue = $cacheEncoder->decodeUri($safeValue);

统计信息

  • 总下载量: 238
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-09-19