承接 revenuewire/simple-cache 相关项目开发

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

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

revenuewire/simple-cache

最新稳定版本:v1.0.5

Composer 安装命令:

composer require revenuewire/simple-cache

包简介

RW Simple Cache

README 文档

README

Build Status Coverage Status Latest Stable Version License composer.lock

Install

composer require revenuewire/simple-cache

About

A PSR-16 "Simple Cache" implementation for adding cache to your applications.

Adapters

The following cache adapters are available:

  • Array
  • APCu
  • DyanamoDB
  • File

Examples

<?php
    /**
    * File Cache
    */
    $cache = new \RW\FileCache("/tmp/unit-test-" . uniqid());
    $k = "hello";
    $v = "world";
    $cache->set($k, $v); //return true
    $cache->get($k); //world
    $cache->has($k); //true
    $cache->delete($k); //true
    $cache->get($k); //null
    $cache->has($k); //false
    
    /**
    * DynamoDB Cache
    */
    $region = "us-west-1";
    $tableName = "sandbox-demo-cache";
    $cache = new \RW\DynamoCache($tableName, [
        "region" => $region,
    ]);

Run unittest

sh ./bin/go-test.sh

DynamoDB Schema

AWSTemplateFormatVersion: '2010-09-09'
Description: (2-resources) DynamoDB Cache v1.0.0
Parameters:
  EnvironmentType:
    Description: The environment type
    Type: String
    Default: sandbox
    AllowedValues:
      - production
      - sandbox
    ConstraintDescription: must be a production or sandbox

  APP:
    Description: APP Name
    Type: String
    AllowedPattern: "^[a-z0-9-]+$"
    Default: "demo"
    MinLength: 4
    MaxLength: 30
    
Mappings:
  BuildEnvironment:
    sandbox:
      "env": "sandbox"
      "capacityUnits": 5
    production:
      "env": "production"
      "capacityUnits": 5

Resources:
  DynamoDBTable:
    Type: AWS::DynamoDB::Table
    Properties:
      TableName: !Sub "${EnvironmentType}-${APP}-cache"
      AttributeDefinitions:
        - AttributeName: id
          AttributeType: S
      KeySchema:
        - AttributeName: id
          KeyType: HASH
      ProvisionedThroughput:
        ReadCapacityUnits: { "Fn::FindInMap" : [ "BuildEnvironment", { "Ref" : "EnvironmentType" }, "capacityUnits"]}
        WriteCapacityUnits: { "Fn::FindInMap" : [ "BuildEnvironment", { "Ref" : "EnvironmentType" }, "capacityUnits"]}
      TimeToLiveSpecification:
        AttributeName: expiry
        Enabled: true

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2018-04-01