optimisme/optimisme-cache 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

optimisme/optimisme-cache

Composer 安装命令:

composer require optimisme/optimisme-cache

包简介

A simple cache package

README 文档

README

Insert a simple cache system on your website in less than 5 minutes

How ton install Optimisme Cache ?

You can install Optimisme Cache thank's to composer

composer require optimisme/optimisme-cache

How to use Optimisme Cache ? (2 methods)

1. Using the cache function

<?php
include 'vendor/autoload.php';

$cacheManager = new Optimisme\Cache();

$cacheManager->cache(function() {
    ?>
    
    // Write your code there

    <?php
});
?>

2. Using the open and close functions

<?php
include 'vendor/autoload.php';

$cacheManager = new Optimisme\Cache();

if ($cacheManager->open()):
    ?>

    // Write your code there

    <?php
    $cacheManager->save();
endif;
?>

Settings

When you create an instance of Optimisme Cache, you can set two specific settings :

  • $name : You can specifiy a custom name for exemple is this component is used many times in different places. By default or if you set it to null, a name will be automatically generated according to the current page url.
  • $cachetime : Time in seconds while this specific cached code will stay in cache

Optimisme Cache also supports caching subcomponents of page or components.

<?php
include 'vendor/autoload.php';

$pageCache = new Optimisme\Cache(null, 1200);
$pageCache->cache(function() {
    ?>
    // Write your page code there
    <?php
    $componentCache = new Optimisme\Cache('my-custom-component-name', 600);

    $componentCache->cache(function() {
        ?>
        
        // Write your component code there

        <?php
    });
});
?>

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2020-04-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固