定制 rah/rah_memcached 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

rah/rah_memcached

Composer 安装命令:

composer require rah/rah_memcached

包简介

Memcached Textpattern CMS templates

README 文档

README

Download | Packagist | Issues

A plugin for Textpattern CMS that stores parts of your templates in Memcached, a distributed in-memory key-value caching system.

Install

Using Composer:

$ composer require rah/rah_memcached

Or download an installer package.

Basics

The plugin, rah_memcached, introduces a new container tag to Textpattern’s arsenal. The tag stores the wrapped content, and variables set within it, in Memcached’s in-memory storage.

<rah::memcached>
    <txp:variable name="variable1" value="value" />
    <txp:article_custom limit="200">
        <txp:title />
    </txp:article_custom>
</rah::memcached>

On subsequent calls the resulting output markup and variables will be loaded from memory, skipping template parsing and code execution, speeding up your site and alleviating database load.

Requirements

Configuration

Connected server can be configured through Textpattern’s textpattern/config.php file:

define('RAH_MEMCACHED_HOST', 'localhost');
define('RAH_MEMCACHED_PORT', 11211);

Attributes

<rah::memcached>
    ...contained statement...
</rah::memcached>

The tag is a container and attributes for it follow.

name
Sets a name, a key, for the cached item. The given name is used identify the item, and save and fetch it from the storage. If a name is not defined, it’s automatically created by hashing the given contained markup. While the name is optional, giving it is more efficient and avoids any potential hash collisions.
Default: undefined Example: name="mykey"

expires
Time in seconds it takes to the stored item to expire and be refreshed. If zero (0), the cache is kept in memory until the cache is flushed or Memcached is restarted.
Default: 0 Example: expires="3600"

persist
If enabled, ignores content updates as set by site’s lastmod timestamp. By default, the cache is invalidated when Texptatern’s lastmod timestamp is updated, which is done when any content is updated.
Default: disabled Example: persist

Examples

Store section navigation in memory

<rah::memcached name="navigation">
    <txp:section_list wraptag="ul" break="li">
        <txp:section />
    </txp:section_list>
</rah::memcached>

Store variables in memory

<rah::memcached>
    <txp:variable name="color" value="red" />
    <txp:variable name="size" value="small" />
</rah::memcached>

Color: <txp:variable name="color" />
Size: <txp:variable name="size" />

Changelog

Version 0.3.0 – 2022/04/22

  • Fixes PHP >= 8.1 compatibility.
  • Now requires PHP >= 8.1.

Version 0.2.0 – 2022/04/17

  • Register the tag for Textpattern >= 4.7.0 compatibility.
  • Replaced lastmod attribute with persist.
  • Now requires PHP >= 7.2.0.
  • Now requires Textpattern >= 4.7.0.

Version 0.1.0 – 2014/03/19

  • Initial release.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-2.0
  • 更新时间: 2014-03-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固