GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - phpguru/Memory: PHP Memory Cacher - best cachers in one interface, with nice features

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

104 Commits
104 Commits

Folders and files

NameName
Last commit message
Last commit date
Shm
Shm
 
 
Tests
Tests
 
 
APCObject.php
APCObject.php
 
 
IMemcacheDecorator.php
IMemcacheDecorator.php
 
 
IMemoryStorage.php
IMemoryStorage.php
 
 
IRedisServer.php
IRedisServer.php
 
 
KeyAutoUnlocker.php
KeyAutoUnlocker.php
 
 
MemcacheObject.php
MemcacheObject.php
 
 
MemcachedDecorator.php
MemcachedDecorator.php
 
 
MemcachedObject.php
MemcachedObject.php
 
 
MemoryObject.php
MemoryObject.php
 
 
PhpRedisObject.php
PhpRedisObject.php
 
 
README.markdown
README.markdown
 
 
RedisObject.php
RedisObject.php
 
 
RedisServer.php
RedisServer.php
 
 
demo.php
demo.php
 
 

Repository files navigation

PHP Memory Cacher

##Key-value storage in memory As a storage can be used:

  • APC
  • Redis
  • Memcache
  • Shared memory

All storage objects have one interface, so you can switch them without changing the working code.

##Features:

  • Tags for keys
  • Dog-pile and race-condition effects are excluded
  • Increment can work with arrays, strings and numeric values
  • MultiAccess class can be used for any resource, to gain access one write multiple read

##Usage: See demo.php to get documentation.

##Requirements: You can use each storage separately, requirements are individually for storages

###PHP version: 5.3+ (maybe 5.2+, not checked)

###For APCObject: APC should be installed, and this setting should be added in php.ini (or apc.ini if you use it)

  • apc.slam_defense = Off
  • recommended: apc.user_ttl = 0

###For Memcache: Memcache or Memcached PHP extension should be installed.
Memcache is not the fastest and most secure storage, so use it only when necessary. Read more

###For Redis: Redis server should be installed (in debian/ubuntu: "apt-get install redis-server"). Also, phpredis (if installed) can be used as client library - just use PhpRedisObject instead of default RedisObject.

###For SHMObject and MultiAccess: PHP should support shm-functions and msg-functions (--enable-shmop --enable-sysvsem --enable-sysvshm --enable-sysvmsg)
Should be used only in specific cases (e.g. mutexes), or when other extensions can not be installed.

#Storages comparison: APC is a very fast and easy to use storage, use it in most cases. If APC can not be used for caching data, or you just like Redis - use Redis. Redis and Memcache can be used for cross-process communication. Also, data in Redis storage will be restored even after server reboot. Don't want to install Redis (it's just 1 line in console :))? Use Memcache. If you can't install any third-party packages, you can use Shared Memory - but your PHP should be compiled with support of shmop-functions.

##Performance comparison

  • APC - best performance, let speed result of APC in benchmark is 1.
  • PhpRedis - speed 1.23
  • Redis - speed 1.6
  • Shared memory - speed 130
  • Memcache - speed 192 (slowest)

TODO:

  • Atomize increment operation

Look at the comments in demo.php for additional info. Ask, what you want to see commented.

License: MIT

About

PHP Memory Cacher - best cachers in one interface, with nice features

Resources

Readme
Activity

Stars

1 star

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.