A fast, lock-free, shared memory user data cache for PHP

Overview

Yac - Yet Another Cache

Build Status Build status Build Status

Yac is a shared and lockless memory user data cache for PHP.

it can be used to replace APC or local memcached.

Requirement

  • PHP 7 +

Install

$/path/to/phpize
$./configure --with-php-config=/path/to/php-config
$make && make install

Note

  1. Yac is a lockless cache, you should try to avoid or reduce the probability of multiple processes set one same key
  2. Yac use partial crc, you'd better re-arrange your cache content, place the most important(mutable) bytes at the head or tail

Restrictions

  1. Cache key cannot be longer than 48 (YAC_MAX_KEY_LEN) bytes
  2. Cache Value cannot be longer than 64M (YAC_MAX_VALUE_RAW_LEN) bytes
  3. Cache Value after compressed cannot be longer than 1M (YAC_MAX_VALUE_COMPRESSED_LEN) bytes

InIs

yac.enable = 1

yac.keys_memory_size = 4M ; 4M can get 30K key slots, 32M can get 100K key slots

yac.values_memory_size = 64M

yac.compress_threshold = -1

yac.enable_cli = 0 ; whether enable yac with cli, default 0

yac.serializer = php ; since yac 2.2.0 , specific seralizer yac used
                       could be json(--enable-json), msgpack(--enable-msgpack) or igbinary(--enable-igbinary)

Constants

YAC_VERSION

YAC_MAX_KEY_LEN = 48 ; if your key is longer than this, maybe you can use md5 result as the key

YAC_MAX_VALUE_RAW_LEN = 64M

YAC_MAX_VALUE_COMPRESSED_LEN = 1M

YAC_SERIALIZER_PHP = 0   ; since yac-2.2.0

YAC_SERIALIZER_JSON = 1  ; since yac-2.2.0

YAC_SERIALIZER_MSGPACK = 2 ; since yac-2.2.0

YAC_SERIALIZER_IGBINARY = 3 ; since yac-2.2.0

YAC_SERIALIZER  ; serializer according to yac.serializer, default is YAC_SERIALIZER_PHP

Methods

Yac::__construct

   Yac::__construct([string $prefix = ""])

Constructor of Yac, you can specify a prefix which will used to prepend to any keys when doing set/get/delete

">

   $yac = new Yac("myproduct_");
?>

Yac::set

   Yac::set($key, $value[, $ttl = 0])
   Yac::set(array $kvs[, $ttl = 0])

Store a value into Yac cache, keys are cache-unique, so storing a second value with the same key will overwrite the original value.

Return true on success, return false on error (Like no memory, can not obtain cas write right)

set( array( "dummy" => "foo", "dummy2" => "foo", ) ); ?>">

$yac = new Yac();
$yac->set("foo", "bar");
$yac->set(
    array(
        "dummy" => "foo",
        "dummy2" => "foo",
        )
    );
?>

Note:

As Yac 2.1, Store may failure if cas competition fails, you may need to do:

while (!($yac->set("important", "value")));

if you need the value to be stored properly.

Yac::get

   Yac::get(array|string $key[, &$cas = NULL])

Fetches a stored variable from the cache. If an array is passed then each element is fetched and returned.

Return the value on success, return false on error(Like no memory, can not obtain cas write right)

set( array( "dummy" => "foo", "dummy2" => "foo", ) ); $yac->get("dummy"); $yac->get(array("dummy", "dummy2")); ?>">

$yac = new Yac();
$yac->set("foo", "bar");
$yac->set(
    array(
        "dummy" => "foo",
        "dummy2" => "foo",
        )
    );
$yac->get("dummy");
$yac->get(array("dummy", "dummy2"));
?>

Yac::delete

   Yac::delete(array|string $keys[, $delay=0])

Removes a stored variable from the cache. If delay is specified, then the value will be deleted after $delay seconds.

Yac::flush

   Yac::flush()

Immediately invalidates all existing items. it doesn't actually free any resources, it only marks all the items as invalid.

Yac::info

   Yac::info(void)

Get cache info

int(541065216) ["slots_memory_size"]=> int(4194304) ["values_memory_size"]=> int(536870912) ["segment_size"]=> int(4194304) ["segment_num"]=> int(128) ["miss"]=> int(0) ["hits"]=> int(955) ["fails"]=> int(0) ["kicks"]=> int(0) ["slots_size"]=> int(32768) ["slots_used"]=> int(955) } */">

  ....
  var_dump($yac->info());
  /* will return an array like:
  array(11) {
      ["memory_size"]=> int(541065216)
      ["slots_memory_size"]=> int(4194304)
      ["values_memory_size"]=> int(536870912)
      ["segment_size"]=> int(4194304)
      ["segment_num"]=> int(128)
      ["miss"]=> int(0)
      ["hits"]=> int(955)
      ["fails"]=> int(0)
      ["kicks"]=> int(0)
      ["slots_size"]=> int(32768)
      ["slots_used"]=> int(955)
  }
  */
Comments
  • 内存开大以后会遇到 signal 11

    内存开大以后会遇到 signal 11

    hi 鸟哥, 我们在线上应用yac的时候遇到了一个问题:

    如果使用yac的默认配置(4M/64M),运行起来是没有问题的,但是把缓存空间翻倍就会大概每隔5分钟遇到:

    [pool p-web-0] child 21377 exited on signal 11 (SIGSEGV - core dumped) after 262.000868 seconds from start
    

    附上yac的配置

    yac.enable = 1
    yac.keys_memory_size = 8M
    yac.values_memory_size = 128M
    yac.compress_threshold = -1
    
    opened by gobattle 12
  • Are there any plans to bring this to pecl?

    Are there any plans to bring this to pecl?

    I would like to ask kindly if there are any plans to bring yac to pecl? I would love to get an easy way to install yac along with opcache to fit our needs of opcode- and userland-caching.

    opened by benbender 9
  • Yac is only faster on apc in some special cases

    Yac is only faster on apc in some special cases

    Hi, I've taken your example from http://www.laruence.com/2013/03/18/2846.html and you are right Yac seems to be quite faster as apc is. So I moved it to a real case program, where some results from the database are cached, but found out, that Yac is a little slower (not much, but 10 %). After playing around with your example, I found out, that apc is slower only in cases, where the key is longer than a certain length. Your example with 10000 rounds gives me:

    Yac:

    $yac = new Yac();
    
    $start = microtime(true);
    for ($i = 0; $i<10000; $i++) {
        $key =  "xxx" . rand(1, 10000);
        $value = str_repeat("x", rand(1, 10000));
    
        if (!$yac->set($key, $value)) {
            var_dump("write " . $i);
        }
    
        if ($value != ($new = $yac->get($key))) {
            var_dump("read " . $i);
        }
    }
    echo (microtime(true)-$start).'<br />';
    
    $start = microtime(true);
    for ($i = 0; $i<10000; $i++) {
        $key =  "xxx" . rand(1, 10000);
        $value = str_repeat("x", rand(1, 10000));
    
        if (!apc_store($key, $value)) {
            var_dump("write " . $i);
        }
    
        if ($value != ($new = apc_fetch($key))) {
            var_dump("read " . $i);
        }
    }
    echo (microtime(true)-$start).'<br />';
    

    Yac: 0.11415910720825 <- Yac faster APC: 0.12692189216614


    $yac = new Yac();
    
    $start = microtime(true);
    for ($i = 0; $i<10000; $i++) {
        $key =  md5("y" . rand(1, 100)); // <- the key length is the only difference!
        $value = str_repeat("x", rand(1, 10000));
    
        if (!$yac->set($key, $value)) {
            var_dump("write " . $i);
        }
    
        if ($value != ($new = $yac->get($key))) {
            var_dump("read " . $i);
        }
    }
    echo (microtime(true)-$start).'<br />';
    ?>
    APC:
    <?php
    
    $start = microtime(true);
    for ($i = 0; $i<10000; $i++) {
        $key =  md5("y" . rand(1, 100)); // <- the key length is the only difference!
        $value = str_repeat("x", rand(1, 10000));
    
        if (!apc_store($key, $value)) {
            var_dump("write " . $i);
        }
    
        if ($value != ($new = apc_fetch($key))) {
            var_dump("read " . $i);
        }
    }
    echo (microtime(true)-$start).'<br />';
    

    Yac: 0.11087489128113 APC: 0.094645977020264 <- APC is faster

    In most cases this will be no problem, as Yac is on very constant speed, but in the cases I testet over a longer period, apc seems to be a better choice so far. Maybe my investigation will help you to improve Yac. :+1:

    opened by AnonSphere 7
  • 使用 Yac 2.0.2 时出现了缓存不一致的问题

    使用 Yac 2.0.2 时出现了缓存不一致的问题

    环境

    $ cat /proc/version
    Linux version 3.10.0-1160.11.1.el7.x86_64 gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) ) 
    
    $ php/bin/php -v
    PHP 7.1.10 (cli) (built: Jan 18 2018 19:52:06) ( NTS )
    Copyright (c) 1997-2017 The PHP Group
    Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
        with Zend OPcache v7.1.10, Copyright (c) 1999-2017, by Zend Technologies
    
    $ php/bin/php --ri yac
    yac
    
    yac support => enabled
    Version => 2.0.2
    Shared Memory => mmap
    Serializer => php
    
    Directive => Local Value => Master Value
    yac.enable => On => On
    yac.debug => Off => Off
    yac.keys_memory_size => 4M => 4M
    yac.values_memory_size => 64M => 64M
    yac.compress_threshold => -1 => -1
    yac.enable_cli => 1 => 1
    
                                    Cache info
    Total Shared Memory Usage(memory_size) => 71303168
    Total Shared Memory Usage for keys(keys_memory_size) => 4194304
    Total Shared Memory Usage for values(values_memory_size) => 67108864
    Size of Shared Memory Segment(segment_size) => 4194304
    Number of Segments (segment_num) => 16
    Total Slots Number(slots_size) => 32768
    Total Used Slots(slots_num) => 0
    

    问题描述

    我们有一个 ip.conf 文件,里边维护了一批 ip 白名单,且这个文件的最近一次变更是在 10 月 29 号。 ip.conf 文件,在 yac 中的缓存过期时间是 86400s ~ 172800s ( 1天 ~ 2天)。

    问题出现在 11 月 4 号的凌晨 2 点,代码里读取到的 ip 与 文件里的 ip 出现了不一致的情况。 内存里读到的 ip:10.18..63.254 而实际文件里的 ip:10.188.63.254

    缓存不一致的问题已经在我们生产环境第二次出现了,不知道是不是已知问题?

    麻烦鸟哥帮忙看下咋回事,感谢

    opened by zhongweikang 6
  • php7-yac疑问

    php7-yac疑问

    <?php
    
    $yac = new Yac();
    
    $yac->set('950ff7a54a39bdce5304700e17a5a0cd', array(1 => 10), 10099990);
    var_dump($yac->get('950ff7a54a39bdce5304700e17a5a0cd'));
    

    php test.php 输出

    array(1) {
      [1]=>
      int(10)
    }
    

    当注释掉这行,

    set('950ff7a54a39bdce5304700e17a5a0cd', array(1 => 10), 10099990); var_dump($yac->get('950ff7a54a39bdce5304700e17a5a0cd')); ``` php test.php,输出 false。why? ```
    opened by captainQW 5
  • 按照文档提示设置

    按照文档提示设置

    key 保存不进去。

    set("foo", "bar"); $yac->set( array( "dummy" => "foo", "dummy2" => "foo", ) ); var_dump($yac->get("dummy")); 获取到是false ,文档中提示的常量是可以打印的。
    opened by guanhui07 4
  • $functions = get_extension_funcs(

    $functions = get_extension_funcs("yac"); return boolean(false)

    $functions = get_extension_funcs("yac"); return boolean(false)

    php version:

    PHP 7.1.0-dev (cli) (built: Apr 15 2016 09:37:48) ( NTS DEBUG )
    Copyright (c) 1997-2016 The PHP Group
    Zend Engine v3.1.0-dev, Copyright (c) 1998-2016 Zend Technologies
    
    opened by joostshao 4
  • Compile error with pecl install on travis

    Compile error with pecl install on travis

    See https://travis-ci.org/marc-mabe/zend-cache/jobs/98510360 (search for $ if [[ $PECL_INSTALL_YAC != '' ]]; then pecl install $PECL_INSTALL_YAC && phpenv config-add .ci/yac.ini || return 0 ; fi)

    Output for yac-2.0.0 on PHP 7:

    $ if [[ $PECL_INSTALL_YAC != '' ]]; then pecl install $PECL_INSTALL_YAC && phpenv config-add .ci/yac.ini || return 0 ; fi
    
    downloading yac-2.0.0.tgz ...
    
    Starting to download yac-2.0.0.tgz (32,600 bytes)
    
    .........done: 32,600 bytes
    
    16 source files, building
    
    running: phpize
    
    Configuring for:
    
    PHP Api Version:         20151012
    
    Zend Module Api No:      20151012
    
    Zend Extension Api No:   320151012
    
    building in /tmp/pear/temp/pear-build-travisWjsBm6/yac-2.0.0
    
    running: /tmp/pear/temp/yac/configure --with-php-config=/home/travis/.phpenv/versions/7.0.0/bin/php-config
    
    checking for grep that handles long lines and -e... /bin/grep
    
    checking for egrep... /bin/grep -E
    
    checking for a sed that does not truncate output... /bin/sed
    
    checking for cc... cc
    
    checking whether the C compiler works... yes
    
    checking for C compiler default output file name... a.out
    
    checking for suffix of executables...
    
    checking whether we are cross compiling... no
    
    checking for suffix of object files... o
    
    checking whether we are using the GNU C compiler... yes
    
    checking whether cc accepts -g... yes
    
    checking for cc option to accept ISO C89... none needed
    
    checking how to run the C preprocessor... cc -E
    
    checking for icc... no
    
    checking for suncc... no
    
    checking whether cc understands -c and -o together... yes
    
    checking for system library directory... lib
    
    checking if compiler supports -R... no
    
    checking if compiler supports -Wl,-rpath,... yes
    
    checking build system type... x86_64-unknown-linux-gnu
    
    checking host system type... x86_64-unknown-linux-gnu
    
    checking target system type... x86_64-unknown-linux-gnu
    
    checking for PHP prefix... /home/travis/.phpenv/versions/7.0.0
    
    checking for PHP includes... -I/home/travis/.phpenv/versions/7.0.0/include/php -I/home/travis/.phpenv/versions/7.0.0/include/php/main -I/home/travis/.phpenv/versions/7.0.0/include/php/TSRM -I/home/travis/.phpenv/versions/7.0.0/include/php/Zend -I/home/travis/.phpenv/versions/7.0.0/include/php/ext -I/home/travis/.phpenv/versions/7.0.0/include/php/ext/date/lib
    
    checking for PHP extension directory... /home/travis/.phpenv/versions/7.0.0/lib/php/extensions/no-debug-zts-20151012
    
    checking for PHP installed headers prefix... /home/travis/.phpenv/versions/7.0.0/include/php
    
    checking if debug is enabled... no
    
    checking if zts is enabled... yes
    
    checking for re2c... re2c
    
    checking for re2c version... 0.13.5 (ok)
    
    checking for gawk... gawk
    
    checking whether to enable yac support... yes, shared
    
    checking wheter to use system FastLZ bibrary... no
    
    checking for sysvipc shared memory support... yes
    
    checking for mmap() using MAP_ANON shared memory support... yes
    
    checking for mmap() using /dev/zero shared memory support... yes
    
    checking for ld used by cc... /usr/bin/ld
    
    checking if the linker (/usr/bin/ld) is GNU ld... yes
    
    checking for /usr/bin/ld option to reload object files... -r
    
    checking for BSD-compatible nm... /usr/bin/nm -B
    
    checking whether ln -s works... yes
    
    checking how to recognize dependent libraries... pass_all
    
    checking dlfcn.h usability... yes
    
    checking dlfcn.h presence... yes
    
    checking for dlfcn.h... yes
    
    checking the maximum length of command line arguments... 1572864
    
    checking command to parse /usr/bin/nm -B output from cc object... ok
    
    checking for objdir... .libs
    
    checking for ar... ar
    
    checking for ranlib... ranlib
    
    checking for strip... strip
    
    checking if cc supports -fno-rtti -fno-exceptions... no
    
    checking for cc option to produce PIC... -fPIC
    
    checking if cc PIC flag -fPIC works... yes
    
    checking if cc static flag -static works... yes
    
    checking if cc supports -c -o file.o... yes
    
    checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
    
    checking whether -lc should be explicitly linked in... no
    
    checking dynamic linker characteristics... GNU/Linux ld.so
    
    checking how to hardcode library paths into programs... immediate
    
    checking whether stripping libraries is possible... yes
    
    checking if libtool supports shared libraries... yes
    
    checking whether to build shared libraries... yes
    
    checking whether to build static libraries... no
    
    creating libtool
    
    appending configuration tag "CXX" to libtool
    
    configure: creating ./config.status
    
    config.status: creating config.h
    
    running: make
    
    /bin/bash /tmp/pear/temp/pear-build-travisWjsBm6/yac-2.0.0/libtool --mode=compile cc  -I. -I/tmp/pear/temp/yac -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-travisWjsBm6/yac-2.0.0/include -I/tmp/pear/temp/pear-build-travisWjsBm6/yac-2.0.0/main -I/tmp/pear/temp/yac -I/home/travis/.phpenv/versions/7.0.0/include/php -I/home/travis/.phpenv/versions/7.0.0/include/php/main -I/home/travis/.phpenv/versions/7.0.0/include/php/TSRM -I/home/travis/.phpenv/versions/7.0.0/include/php/Zend -I/home/travis/.phpenv/versions/7.0.0/include/php/ext -I/home/travis/.phpenv/versions/7.0.0/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/yac/yac.c -o yac.lo
    
    mkdir .libs
    
     cc -I. -I/tmp/pear/temp/yac -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-travisWjsBm6/yac-2.0.0/include -I/tmp/pear/temp/pear-build-travisWjsBm6/yac-2.0.0/main -I/tmp/pear/temp/yac -I/home/travis/.phpenv/versions/7.0.0/include/php -I/home/travis/.phpenv/versions/7.0.0/include/php/main -I/home/travis/.phpenv/versions/7.0.0/include/php/TSRM -I/home/travis/.phpenv/versions/7.0.0/include/php/Zend -I/home/travis/.phpenv/versions/7.0.0/include/php/ext -I/home/travis/.phpenv/versions/7.0.0/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/yac/yac.c  -fPIC -DPIC -o .libs/yac.o
    
    /bin/bash /tmp/pear/temp/pear-build-travisWjsBm6/yac-2.0.0/libtool --mode=compile cc  -I. -I/tmp/pear/temp/yac -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-travisWjsBm6/yac-2.0.0/include -I/tmp/pear/temp/pear-build-travisWjsBm6/yac-2.0.0/main -I/tmp/pear/temp/yac -I/home/travis/.phpenv/versions/7.0.0/include/php -I/home/travis/.phpenv/versions/7.0.0/include/php/main -I/home/travis/.phpenv/versions/7.0.0/include/php/TSRM -I/home/travis/.phpenv/versions/7.0.0/include/php/Zend -I/home/travis/.phpenv/versions/7.0.0/include/php/ext -I/home/travis/.phpenv/versions/7.0.0/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/yac/storage/yac_storage.c -o storage/yac_storage.lo
    
    mkdir storage/.libs
    
     cc -I. -I/tmp/pear/temp/yac -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-travisWjsBm6/yac-2.0.0/include -I/tmp/pear/temp/pear-build-travisWjsBm6/yac-2.0.0/main -I/tmp/pear/temp/yac -I/home/travis/.phpenv/versions/7.0.0/include/php -I/home/travis/.phpenv/versions/7.0.0/include/php/main -I/home/travis/.phpenv/versions/7.0.0/include/php/TSRM -I/home/travis/.phpenv/versions/7.0.0/include/php/Zend -I/home/travis/.phpenv/versions/7.0.0/include/php/ext -I/home/travis/.phpenv/versions/7.0.0/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/yac/storage/yac_storage.c  -fPIC -DPIC -o storage/.libs/yac_storage.o
    
    /bin/bash /tmp/pear/temp/pear-build-travisWjsBm6/yac-2.0.0/libtool --mode=compile cc  -I. -I/tmp/pear/temp/yac -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-travisWjsBm6/yac-2.0.0/include -I/tmp/pear/temp/pear-build-travisWjsBm6/yac-2.0.0/main -I/tmp/pear/temp/yac -I/home/travis/.phpenv/versions/7.0.0/include/php -I/home/travis/.phpenv/versions/7.0.0/include/php/main -I/home/travis/.phpenv/versions/7.0.0/include/php/TSRM -I/home/travis/.phpenv/versions/7.0.0/include/php/Zend -I/home/travis/.phpenv/versions/7.0.0/include/php/ext -I/home/travis/.phpenv/versions/7.0.0/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/yac/storage/allocator/yac_allocator.c -o storage/allocator/yac_allocator.lo
    
    mkdir storage/allocator/.libs
    
     cc -I. -I/tmp/pear/temp/yac -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-travisWjsBm6/yac-2.0.0/include -I/tmp/pear/temp/pear-build-travisWjsBm6/yac-2.0.0/main -I/tmp/pear/temp/yac -I/home/travis/.phpenv/versions/7.0.0/include/php -I/home/travis/.phpenv/versions/7.0.0/include/php/main -I/home/travis/.phpenv/versions/7.0.0/include/php/TSRM -I/home/travis/.phpenv/versions/7.0.0/include/php/Zend -I/home/travis/.phpenv/versions/7.0.0/include/php/ext -I/home/travis/.phpenv/versions/7.0.0/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/yac/storage/allocator/yac_allocator.c  -fPIC -DPIC -o storage/allocator/.libs/yac_allocator.o
    
    /bin/bash /tmp/pear/temp/pear-build-travisWjsBm6/yac-2.0.0/libtool --mode=compile cc  -I. -I/tmp/pear/temp/yac -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-travisWjsBm6/yac-2.0.0/include -I/tmp/pear/temp/pear-build-travisWjsBm6/yac-2.0.0/main -I/tmp/pear/temp/yac -I/home/travis/.phpenv/versions/7.0.0/include/php -I/home/travis/.phpenv/versions/7.0.0/include/php/main -I/home/travis/.phpenv/versions/7.0.0/include/php/TSRM -I/home/travis/.phpenv/versions/7.0.0/include/php/Zend -I/home/travis/.phpenv/versions/7.0.0/include/php/ext -I/home/travis/.phpenv/versions/7.0.0/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/yac/storage/allocator/allocators/shm.c -o storage/allocator/allocators/shm.lo
    
    mkdir storage/allocator/allocators/.libs
    
     cc -I. -I/tmp/pear/temp/yac -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-travisWjsBm6/yac-2.0.0/include -I/tmp/pear/temp/pear-build-travisWjsBm6/yac-2.0.0/main -I/tmp/pear/temp/yac -I/home/travis/.phpenv/versions/7.0.0/include/php -I/home/travis/.phpenv/versions/7.0.0/include/php/main -I/home/travis/.phpenv/versions/7.0.0/include/php/TSRM -I/home/travis/.phpenv/versions/7.0.0/include/php/Zend -I/home/travis/.phpenv/versions/7.0.0/include/php/ext -I/home/travis/.phpenv/versions/7.0.0/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/yac/storage/allocator/allocators/shm.c  -fPIC -DPIC -o storage/allocator/allocators/.libs/shm.o
    
    /bin/bash /tmp/pear/temp/pear-build-travisWjsBm6/yac-2.0.0/libtool --mode=compile cc  -I. -I/tmp/pear/temp/yac -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-travisWjsBm6/yac-2.0.0/include -I/tmp/pear/temp/pear-build-travisWjsBm6/yac-2.0.0/main -I/tmp/pear/temp/yac -I/home/travis/.phpenv/versions/7.0.0/include/php -I/home/travis/.phpenv/versions/7.0.0/include/php/main -I/home/travis/.phpenv/versions/7.0.0/include/php/TSRM -I/home/travis/.phpenv/versions/7.0.0/include/php/Zend -I/home/travis/.phpenv/versions/7.0.0/include/php/ext -I/home/travis/.phpenv/versions/7.0.0/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/yac/storage/allocator/allocators/mmap.c -o storage/allocator/allocators/mmap.lo
    
     cc -I. -I/tmp/pear/temp/yac -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-travisWjsBm6/yac-2.0.0/include -I/tmp/pear/temp/pear-build-travisWjsBm6/yac-2.0.0/main -I/tmp/pear/temp/yac -I/home/travis/.phpenv/versions/7.0.0/include/php -I/home/travis/.phpenv/versions/7.0.0/include/php/main -I/home/travis/.phpenv/versions/7.0.0/include/php/TSRM -I/home/travis/.phpenv/versions/7.0.0/include/php/Zend -I/home/travis/.phpenv/versions/7.0.0/include/php/ext -I/home/travis/.phpenv/versions/7.0.0/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/yac/storage/allocator/allocators/mmap.c  -fPIC -DPIC -o storage/allocator/allocators/.libs/mmap.o
    
    /bin/bash /tmp/pear/temp/pear-build-travisWjsBm6/yac-2.0.0/libtool --mode=compile cc  -I. -I/tmp/pear/temp/yac -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-travisWjsBm6/yac-2.0.0/include -I/tmp/pear/temp/pear-build-travisWjsBm6/yac-2.0.0/main -I/tmp/pear/temp/yac -I/home/travis/.phpenv/versions/7.0.0/include/php -I/home/travis/.phpenv/versions/7.0.0/include/php/main -I/home/travis/.phpenv/versions/7.0.0/include/php/TSRM -I/home/travis/.phpenv/versions/7.0.0/include/php/Zend -I/home/travis/.phpenv/versions/7.0.0/include/php/ext -I/home/travis/.phpenv/versions/7.0.0/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/yac/serializer/php.c -o serializer/php.lo
    
    mkdir serializer/.libs
    
     cc -I. -I/tmp/pear/temp/yac -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-travisWjsBm6/yac-2.0.0/include -I/tmp/pear/temp/pear-build-travisWjsBm6/yac-2.0.0/main -I/tmp/pear/temp/yac -I/home/travis/.phpenv/versions/7.0.0/include/php -I/home/travis/.phpenv/versions/7.0.0/include/php/main -I/home/travis/.phpenv/versions/7.0.0/include/php/TSRM -I/home/travis/.phpenv/versions/7.0.0/include/php/Zend -I/home/travis/.phpenv/versions/7.0.0/include/php/ext -I/home/travis/.phpenv/versions/7.0.0/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/yac/serializer/php.c  -fPIC -DPIC -o serializer/.libs/php.o
    
    /bin/bash /tmp/pear/temp/pear-build-travisWjsBm6/yac-2.0.0/libtool --mode=compile cc  -I. -I/tmp/pear/temp/yac -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-travisWjsBm6/yac-2.0.0/include -I/tmp/pear/temp/pear-build-travisWjsBm6/yac-2.0.0/main -I/tmp/pear/temp/yac -I/home/travis/.phpenv/versions/7.0.0/include/php -I/home/travis/.phpenv/versions/7.0.0/include/php/main -I/home/travis/.phpenv/versions/7.0.0/include/php/TSRM -I/home/travis/.phpenv/versions/7.0.0/include/php/Zend -I/home/travis/.phpenv/versions/7.0.0/include/php/ext -I/home/travis/.phpenv/versions/7.0.0/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/yac/serializer/msgpack.c -o serializer/msgpack.lo
    
     cc -I. -I/tmp/pear/temp/yac -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-travisWjsBm6/yac-2.0.0/include -I/tmp/pear/temp/pear-build-travisWjsBm6/yac-2.0.0/main -I/tmp/pear/temp/yac -I/home/travis/.phpenv/versions/7.0.0/include/php -I/home/travis/.phpenv/versions/7.0.0/include/php/main -I/home/travis/.phpenv/versions/7.0.0/include/php/TSRM -I/home/travis/.phpenv/versions/7.0.0/include/php/Zend -I/home/travis/.phpenv/versions/7.0.0/include/php/ext -I/home/travis/.phpenv/versions/7.0.0/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/yac/serializer/msgpack.c  -fPIC -DPIC -o serializer/.libs/msgpack.o
    
    /bin/bash /tmp/pear/temp/pear-build-travisWjsBm6/yac-2.0.0/libtool --mode=compile cc  -I. -I/tmp/pear/temp/yac -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-travisWjsBm6/yac-2.0.0/include -I/tmp/pear/temp/pear-build-travisWjsBm6/yac-2.0.0/main -I/tmp/pear/temp/yac -I/home/travis/.phpenv/versions/7.0.0/include/php -I/home/travis/.phpenv/versions/7.0.0/include/php/main -I/home/travis/.phpenv/versions/7.0.0/include/php/TSRM -I/home/travis/.phpenv/versions/7.0.0/include/php/Zend -I/home/travis/.phpenv/versions/7.0.0/include/php/ext -I/home/travis/.phpenv/versions/7.0.0/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/yac/compressor/fastlz/fastlz.c -o compressor/fastlz/fastlz.lo
    
    /tmp/pear/temp/pear-build-travisWjsBm6/yac-2.0.0/libtool: line 1283: compressor/fastlz/fastlz.loT: No such file or directory
    
    mkdir compressor/fastlz/.libs
    
    mkdir: cannot create directory `compressor/fastlz/.libs': No such file or directory
    
    make: *** [compressor/fastlz/fastlz.lo] Error 1
    
    ERROR: `make' failed
    

    Output for yac-0.9.2 on PHP 5:

    $ if [[ $PECL_INSTALL_YAC != '' ]]; then pecl install $PECL_INSTALL_YAC && phpenv config-add .ci/yac.ini || return 0 ; fi
    
    WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
    
    downloading yac-0.9.2.tgz ...
    
    Starting to download yac-0.9.2.tgz (34,822 bytes)
    
    .........done: 34,822 bytes
    
    18 source files, building
    
    running: phpize
    
    Configuring for:
    
    PHP Api Version:         20121113
    
    Zend Module Api No:      20121212
    
    Zend Extension Api No:   220121212
    
    building in /tmp/pear/temp/pear-build-travistT8kbp/yac-0.9.2
    
    running: /tmp/pear/temp/yac/configure
    
    checking for grep that handles long lines and -e... /bin/grep
    
    checking for egrep... /bin/grep -E
    
    checking for a sed that does not truncate output... /bin/sed
    
    checking for cc... cc
    
    checking whether the C compiler works... yes
    
    checking for C compiler default output file name... a.out
    
    checking for suffix of executables...
    
    checking whether we are cross compiling... no
    
    checking for suffix of object files... o
    
    checking whether we are using the GNU C compiler... yes
    
    checking whether cc accepts -g... yes
    
    checking for cc option to accept ISO C89... none needed
    
    checking how to run the C preprocessor... cc -E
    
    checking for icc... no
    
    checking for suncc... no
    
    checking whether cc understands -c and -o together... yes
    
    checking for system library directory... lib
    
    checking if compiler supports -R... no
    
    checking if compiler supports -Wl,-rpath,... yes
    
    checking build system type... x86_64-unknown-linux-gnu
    
    checking host system type... x86_64-unknown-linux-gnu
    
    checking target system type... x86_64-unknown-linux-gnu
    
    checking for PHP prefix... /home/travis/.phpenv/versions/5.5.21
    
    checking for PHP includes... -I/home/travis/.phpenv/versions/5.5.21/include/php -I/home/travis/.phpenv/versions/5.5.21/include/php/main -I/home/travis/.phpenv/versions/5.5.21/include/php/TSRM -I/home/travis/.phpenv/versions/5.5.21/include/php/Zend -I/home/travis/.phpenv/versions/5.5.21/include/php/ext -I/home/travis/.phpenv/versions/5.5.21/include/php/ext/date/lib
    
    checking for PHP extension directory... /home/travis/.phpenv/versions/5.5.21/lib/php/extensions/no-debug-zts-20121212
    
    checking for PHP installed headers prefix... /home/travis/.phpenv/versions/5.5.21/include/php
    
    checking if debug is enabled... no
    
    checking if zts is enabled... no
    
    checking for re2c... re2c
    
    checking for re2c version... 0.13.5 (ok)
    
    checking for gawk... gawk
    
    checking whether to enable yac support... yes, shared
    
    checking wheter to use system FastLZ bibrary... no
    
    checking for sysvipc shared memory support... yes
    
    checking for mmap() using MAP_ANON shared memory support... yes
    
    checking for mmap() using /dev/zero shared memory support... yes
    
    checking for ld used by cc... /usr/bin/ld
    
    checking if the linker (/usr/bin/ld) is GNU ld... yes
    
    checking for /usr/bin/ld option to reload object files... -r
    
    checking for BSD-compatible nm... /usr/bin/nm -B
    
    checking whether ln -s works... yes
    
    checking how to recognize dependent libraries... pass_all
    
    checking dlfcn.h usability... yes
    
    checking dlfcn.h presence... yes
    
    checking for dlfcn.h... yes
    
    checking the maximum length of command line arguments... 1572864
    
    checking command to parse /usr/bin/nm -B output from cc object... ok
    
    checking for objdir... .libs
    
    checking for ar... ar
    
    checking for ranlib... ranlib
    
    checking for strip... strip
    
    checking if cc supports -fno-rtti -fno-exceptions... no
    
    checking for cc option to produce PIC... -fPIC
    
    checking if cc PIC flag -fPIC works... yes
    
    checking if cc static flag -static works... yes
    
    checking if cc supports -c -o file.o... yes
    
    checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
    
    checking whether -lc should be explicitly linked in... no
    
    checking dynamic linker characteristics... GNU/Linux ld.so
    
    checking how to hardcode library paths into programs... immediate
    
    checking whether stripping libraries is possible... yes
    
    checking if libtool supports shared libraries... yes
    
    checking whether to build shared libraries... yes
    
    checking whether to build static libraries... no
    
    creating libtool
    
    appending configuration tag "CXX" to libtool
    
    configure: creating ./config.status
    
    config.status: creating config.h
    
    running: make
    
    /bin/bash /tmp/pear/temp/pear-build-travistT8kbp/yac-0.9.2/libtool --mode=compile cc  -I. -I/tmp/pear/temp/yac -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-travistT8kbp/yac-0.9.2/include -I/tmp/pear/temp/pear-build-travistT8kbp/yac-0.9.2/main -I/tmp/pear/temp/yac -I/home/travis/.phpenv/versions/5.5.21/include/php -I/home/travis/.phpenv/versions/5.5.21/include/php/main -I/home/travis/.phpenv/versions/5.5.21/include/php/TSRM -I/home/travis/.phpenv/versions/5.5.21/include/php/Zend -I/home/travis/.phpenv/versions/5.5.21/include/php/ext -I/home/travis/.phpenv/versions/5.5.21/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/yac/yac.c -o yac.lo
    
    mkdir .libs
    
     cc -I. -I/tmp/pear/temp/yac -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-travistT8kbp/yac-0.9.2/include -I/tmp/pear/temp/pear-build-travistT8kbp/yac-0.9.2/main -I/tmp/pear/temp/yac -I/home/travis/.phpenv/versions/5.5.21/include/php -I/home/travis/.phpenv/versions/5.5.21/include/php/main -I/home/travis/.phpenv/versions/5.5.21/include/php/TSRM -I/home/travis/.phpenv/versions/5.5.21/include/php/Zend -I/home/travis/.phpenv/versions/5.5.21/include/php/ext -I/home/travis/.phpenv/versions/5.5.21/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/yac/yac.c  -fPIC -DPIC -o .libs/yac.o
    
    /bin/bash /tmp/pear/temp/pear-build-travistT8kbp/yac-0.9.2/libtool --mode=compile cc  -I. -I/tmp/pear/temp/yac -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-travistT8kbp/yac-0.9.2/include -I/tmp/pear/temp/pear-build-travistT8kbp/yac-0.9.2/main -I/tmp/pear/temp/yac -I/home/travis/.phpenv/versions/5.5.21/include/php -I/home/travis/.phpenv/versions/5.5.21/include/php/main -I/home/travis/.phpenv/versions/5.5.21/include/php/TSRM -I/home/travis/.phpenv/versions/5.5.21/include/php/Zend -I/home/travis/.phpenv/versions/5.5.21/include/php/ext -I/home/travis/.phpenv/versions/5.5.21/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/yac/storage/yac_storage.c -o storage/yac_storage.lo
    
    /tmp/pear/temp/pear-build-travistT8kbp/yac-0.9.2/libtool: line 1283: storage/yac_storage.loT: No such file or directory
    
    mkdir storage/.libs
    
    mkdir: cannot create directory `storage/.libs': No such file or directory
    
    make: *** [storage/yac_storage.lo] Error 1
    
    ERROR: `make' failed
    
    opened by marc-mabe 4
  • Problems under high load

    Problems under high load

    Hi,

    when I execute this script: http://pastebin.com/tUYUnxef

    with this Apache Bench command line options:

    ab -H "Connection:close" -c 20 -n 500 http://www/test_yac.php
    

    I get this result:

    This is ApacheBench, Version 2.3 <$Revision: 655654 $>
    Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
    Licensed to The Apache Software Foundation, http://www.apache.org/
    
    Benchmarking ditta (be patient)
    Completed 100 requests
    Completed 200 requests
    Completed 300 requests
    Completed 400 requests
    Completed 500 requests
    Finished 500 requests
    
    
    Server Software:        Apache/2.2.25
    Server Hostname:        ditta
    Server Port:            80
    
    Document Path:          /test_yac.php
    Document Length:        0 bytes
    
    Concurrency Level:      20
    Time taken for tests:   112.869 seconds
    Complete requests:      500
    Failed requests:        2
       (Connect: 0, Receive: 0, Length: 2, Exceptions: 0)
    Write errors:           0
    Total transferred:      116772 bytes
    HTML transferred:       268 bytes
    Requests per second:    4.43 [#/sec] (mean)
    Time per request:       4514.759 [ms] (mean)
    Time per request:       225.738 [ms] (mean, across all concurrent requests)
    Transfer rate:          1.01 [Kbytes/sec] received
    
    Connection Times (ms)
                  min  mean[+/-sd] median   max
    Connect:        1    3   1.5      3      28
    Processing:  1756 4478 890.6   4436   10193
    Waiting:     1756 4478 889.9   4436   10193
    Total:       1758 4481 890.6   4438   10196
    
    Percentage of the requests served within a certain time (ms)
      50%   4438
      66%   4685
      75%   4826
      80%   4937
      90%   5264
      95%   5808
      98%   6991
      99%   7489
     100%  10196 (longest request)
    

    The errors are: Warning: Yac::get(): Unserialization failed in /usr/local/www/data.default/test_yac.php on line 26 Warning: Yac::get(): Unserialization failed in /usr/local/www/data.default/test_yac.php on line 26

    And this can be reproduced - you get always some erroneous responses

    opened by OlliL 4
  • 在并发写的同时,并发读。yac出现读取数据失败,基本到了不可用的地步

    在并发写的同时,并发读。yac出现读取数据失败,基本到了不可用的地步

    yac和memcache性能对比测试 https://yq.aliyun.com/articles/27323 这里是详细过程@laruence 鸟哥看下是咋回事?

    <?php
    function test_memcache_set(){
        $mem = memcache_connect('127.0.0.1', 11211);
        $value = mt_rand();
        $res = memcache_set($mem, 'var_key', $value, false, 3000);
        var_dump($res);
        if (!$res) {
            header("HTTP/1.0 404 Not Found");
        }
    }
    
    function test_memcache_get(){
        $mem = memcache_connect('127.0.0.1', 11211);
        $res = memcache_get($mem, 'var_key');
        var_dump($res);
        if (!$res) {
            header("HTTP/1.0 404 Not Found");
        } else {
            echo $res;
        }
    }
    
    function test_yac_set(){
        $yac = new Yac();
        $value = mt_rand();
        $res = $yac->set('var_key', $value);
        var_dump($res);
        if (!$res) {
            header("HTTP/1.0 404 Not Found");
        }
    }
    
    function test_yac_get(){
        $yac = new Yac();
        $res = $yac->get('var_key');
        var_dump($res);
        if (!$res) {
            header("HTTP/1.0 404 Not Found");
        } else {
            echo $res;
        }
    
    }
    
    echo $_GET["m"]();
    ?>
    
    ab -t 10 -c 20 http://10.32.232.129/test.php?m=test_yac_get
    Complete requests: 1220
    Failed requests: 829
    (Connect: 0, Length: 829, Exceptions: 0)
    Time per request: 164.116 [ms] (mean)
    
    Complete requests: 1300
    Failed requests: 809
    (Connect: 0, Length: 809, Exceptions: 0)
    Time per request: 154.907 [ms] (mean)
    
    opened by yyxx9988 3
  • docker php:7-fpm-alpine install yac-2.0.1

    docker php:7-fpm-alpine install yac-2.0.1

    Configuring for: PHP Api Version: 20151012 Zend Module Api No: 20151012 Zend Extension Api No: 320151012 checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E checking for a sed that does not truncate output... /bin/sed expr: syntax error ./configure: line 2519: test: =: unary operator expected expr: syntax error ./configure: line 2526: test: =: unary operator expected expr: syntax error ./configure: line 2533: test: =: unary operator expected checking for cc... cc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether cc accepts -g... yes checking for cc option to accept ISO C89... none needed checking how to run the C preprocessor... cc -E checking for icc... no checking for suncc... no

    提示错误 expr: syntax error ./configure: line 2519: test: =: unary operator expected expr: syntax error ./configure: line 2526: test: =: unary operator expected expr: syntax error ./configure: line 2533: test: =: unary operator expected 不知道会有影响吗?

    opened by cq-z 3
  • Use in different processes

    Use in different processes

    Is it possible to use Yac in different processes (not pcintl forks)?

    For example: write values in cron job and read them in some cli/fpm process?

    I cant make it work in this way, looks like data not shared beetween processes. Only works inside one process, or in child processes/forks.

    Im using PHP 8.0.10 and yac 2.3.1 from pecl.

    > php -i | grep yac
    yac
    yac support => enabled
    yac.compress_threshold => 1024 => 1024
    yac.debug => Off => Off
    yac.enable => On => On
    yac.enable_cli => 1 => 1
    yac.keys_memory_size => 32M => 32M
    yac.serializer => igbinary => igbinary
    yac.values_memory_size => 128M => 128M
    
    root@3fab702c5232# php -r "var_dump((new Yac())->set('test', 'test')); "
    bool(true)
    root@3fab702c5232# php -r "var_dump((new Yac())->get('test')); "
    bool(false)
    
    opened by xtrime-ru 0
  • PHP8.1.1+yac-2.3.1 开启 msgpack压缩报错

    PHP8.1.1+yac-2.3.1 开启 msgpack压缩报错

    /bin/bash /tmp/pear/temp/pear-build-defaultuser7rWXtj/yac-2.3.1/libtool --mode=compile cc -I. -I/tmp/pear/temp/yac -I/tmp/pear/temp/pear-build-defaultuser7rWXtj/yac-2.3.1/include -I/tmp/pear/temp/pear-build-defaultuser7rWXtj/yac-2.3.1/main -I/tmp/pear/temp/yac -I/usr/include/php/20210902 -I/usr/include/php/20210902/main -I/usr/include/php/20210902/TSRM -I/usr/include/php/20210902/Zend -I/usr/include/php/20210902/ext -I/usr/include/php/20210902/ext/date/lib  -DHAVE_CONFIG_H  -g -O2    -DZEND_COMPILE_DL_EXT=1 -c /tmp/pear/temp/yac/serializer/msgpack.c -o serializer/msgpack.lo  -MMD -MF serializer/msgpack.dep -MT serializer/msgpack.lo
    libtool: compile:  cc -I. -I/tmp/pear/temp/yac -I/tmp/pear/temp/pear-build-defaultuser7rWXtj/yac-2.3.1/include -I/tmp/pear/temp/pear-build-defaultuser7rWXtj/yac-2.3.1/main -I/tmp/pear/temp/yac -I/usr/include/php/20210902 -I/usr/include/php/20210902/main -I/usr/include/php/20210902/TSRM -I/usr/include/php/20210902/Zend -I/usr/include/php/20210902/ext -I/usr/include/php/20210902/ext/date/lib -DHAVE_CONFIG_H -g -O2 -DZEND_COMPILE_DL_EXT=1 -c /tmp/pear/temp/yac/serializer/msgpack.c -MMD -MF serializer/msgpack.dep -MT serializer/msgpack.lo  -fPIC -DPIC -o serializer/.libs/msgpack.o
    /tmp/pear/temp/yac/serializer/msgpack.c:29:10: fatal error: ext/msgpack/php_msgpack.h: No such file or directory
       29 | #include "ext/msgpack/php_msgpack.h"
          |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    compilation terminated.
    make: *** [Makefile:220: serializer/msgpack.lo] Error 1
    ERROR: `make' failed
    
    
    opened by letwang 3
  • How can I get the actual value memory usage?

    How can I get the actual value memory usage?

    $yac->info() no actual value memory usage is provided, only the total memory allocated and the number of keys used.

    if can provide it,be will more convenient to evaluate the memory allocation, thanks.

    opened by GeniusLe 1
  • Increase key to 64-bytes for PSR-16 Compatibility

    Increase key to 64-bytes for PSR-16 Compatibility

    http://www.php-fig.org/psr/psr-16/ implements a common interface for caches. One requirement is that a cache that implements the interface must be able to support a 64-byte key. I am not sure why YAC chose a 48-byte key, but if it is not difficult to increase the key size, the community would benefit.

    opened by spekary 1
Owner
Xinchen Hui
PHP Stylite
Xinchen Hui
A thin PSR-6 cache wrapper with a generic interface to various caching backends emphasising cache tagging and indexing.

Apix Cache, cache-tagging for PHP Apix Cache is a generic and thin cache wrapper with a PSR-6 interface to various caching backends and emphasising ca

Apix 111 Nov 26, 2022
A library providing platform-specific user directory paths, such as config and cache

Phirs A library providing platform-specific user directory paths, such as config and cache. Inspired by dirs-rs.

Mohammad Amin Chitgarha 7 Mar 1, 2022
Distributed PSR-16 cache implementation for PHP 6 that uses browser cookies to store data

cookiecache Cache beyond the edge with cookies! This library provides a distributed PSR-16 compatible cache implementation for PHP 6 that uses browser

Colin O'Dell 8 Apr 19, 2022
More Than Just a Cache: Redis Data Structures

More Than Just a Cache: Redis Data Structures Redis is a popular key-value store, commonly used as a cache or message broker service. However, it can

Andy Snell 2 Oct 16, 2021
Refresh items in your cache without data races.

Cache Refresh Refresh items in your cache without data races. use Illuminate\Support\Facades\Cache; use Illuminate\Support\Collection; use App\Models\

Laragear 3 Jul 24, 2022
PHP cache library, with adapters for e.g. Memcached, Redis, Couchbase, APC(u), SQL and additional capabilities (e.g. transactions, stampede protection) built on top.

Donate/Support: Documentation: https://www.scrapbook.cash - API reference: https://docs.scrapbook.cash Table of contents Installation & usage Adapters

Matthias Mullie 295 Nov 28, 2022
:zap: Simple Cache Abstraction Layer for PHP

⚡ Simple Cache Class This is a simple Cache Abstraction Layer for PHP >= 7.0 that provides a simple interaction with your cache-server. You can define

Lars Moelleken 27 Dec 8, 2022
LRU Cache implementation in PHP

PHP LRU Cache implementation Intro WTF is a LRU Cache? LRU stands for Least Recently Used. It's a type of cache that usually has a fixed capacity and

Rogério Vicente 61 Jun 23, 2022
Elephant - a highly performant PHP Cache Driver for Kirby 3

?? Kirby3 PHP Cache-Driver Elephant - a highly performant PHP Cache Driver for Kirby 3 Commerical Usage Support open source! This plugin is free but i

Bruno Meilick 11 Apr 6, 2022
PHP local cache

__ ____ _________ ______/ /_ ___ / __ \/ ___/ __ `/ ___/ __ \/ _ \ / /_/ / /__/ /_/ / /__/ / / / __/ / ._

Jayden Lie 48 Sep 9, 2022
PHP Cache Duration

PHP Cache Duration Introduction A readable and fluent way to generate PHP cache time. Built and written by Ajimoti Ibukun Quick Samples Instead of thi

null 27 Nov 8, 2022
Simple artisan command to debug your redis cache. Requires PHP 8.1 & Laravel 9

?? php artisan cache:debug Simple artisan command to debug your redis cache ?? Installation You can install the package via composer: composer require

Juan Pablo Barreto 19 Sep 18, 2022
PHP cache implementation supporting memcached

php cache implementation (PSR-6 and PSR-16) Support for memcached and APCu is included. Memcached $memcached = new Memcached(); $memcached->addServer(

Michael Bretterklieber 1 Aug 11, 2022
The place to keep your cache.

Stash - A PHP Caching Library Stash makes it easy to speed up your code by caching the results of expensive functions or code. Certain actions, like d

Tedious Developments 944 Jan 4, 2023
Cache slam defense using a semaphore to prevent dogpile effect.

metaphore PHP cache slam defense using a semaphore to prevent dogpile effect (aka clobbering updates, stampending herd or Slashdot effect). Problem: t

Przemek Sobstel 102 Sep 28, 2022
Doctrine Cache component

Doctrine Cache Cache component extracted from the Doctrine Common project. Documentation This library is deprecated and will no longer receive bug fix

Doctrine 7.6k Jan 3, 2023
Simple cache abstraction layer implementing PSR-16

sabre/cache This repository is a simple abstraction layer for key-value caches. It implements PSR-16. If you need a super-simple way to support PSR-16

sabre.io 48 Sep 9, 2022
PSR-6 cache implementation adapting a given PSR-16 instance

PSR-6 cache implementation adapting PSR-16 This package provides a PSR-6 cache instance when you only have a PSR-16 cache at hand. As PSR-6 is more fe

null 1 Oct 15, 2021