Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
Redis Object Cache
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
WP Plugins
Redis Object Cache
Commits
7b2d176a
Commit
7b2d176a
authored
11 years ago
by
Eric Mann
Browse files
Options
Downloads
Patches
Plain Diff
Update some docs for 1.0
parent
0b956a3c
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
object-cache.php
+31
-4
31 additions, 4 deletions
object-cache.php
readme.txt
+6
-6
6 additions, 6 deletions
readme.txt
with
37 additions
and
10 deletions
object-cache.php
+
31
−
4
View file @
7b2d176a
<?php
/**
* Plugin Name: Redis Object Cache
* Author: Eric Mann & Erick Hitter
* Version 1.0
* Author:
Eric Mann & Erick Hitter
* Version
:
1.0
*/
/**
...
...
@@ -16,6 +16,8 @@
* @param string $group The group value appended to the $key.
* @param int $expiration The expiration time, defaults to 0.
*
* @global WP_Object_Cache $wp_object_cache
*
* @return bool Returns TRUE on success or FALSE on failure.
*/
function
wp_cache_add
(
$key
,
$value
,
$group
=
''
,
$expiration
=
0
)
{
...
...
@@ -44,6 +46,8 @@ function wp_cache_close() {
* @param int $offset The amount by which to decrement the item's value.
* @param string $group The group value appended to the $key.
*
* @global WP_Object_Cache $wp_object_cache
*
* @return int|bool Returns item's new value on success or FALSE on failure.
*/
function
wp_cache_decr
(
$key
,
$offset
=
1
,
$group
=
''
)
{
...
...
@@ -58,6 +62,8 @@ function wp_cache_decr( $key, $offset = 1, $group = '' ) {
* @param string $group The group value appended to the $key.
* @param int $time The amount of time the server will wait to delete the item in seconds.
*
* @global WP_Object_Cache $wp_object_cache
*
* @return bool Returns TRUE on success or FALSE on failure.
*/
function
wp_cache_delete
(
$key
,
$group
=
''
,
$time
=
0
)
{
...
...
@@ -70,6 +76,8 @@ function wp_cache_delete( $key, $group = '', $time = 0 ) {
*
* @param int $delay Number of seconds to wait before invalidating the items.
*
* @global WP_Object_Cache $wp_object_cache
*
* @return bool Returns TRUE on success or FALSE on failure.
*/
function
wp_cache_flush
(
$delay
=
0
)
{
...
...
@@ -85,6 +93,8 @@ function wp_cache_flush( $delay = 0 ) {
* @param string $key The key under which to store the value.
* @param string $group The group value appended to the $key.
*
* @global WP_Object_Cache $wp_object_cache
*
* @return bool|mixed Cached object value.
*/
function
wp_cache_get
(
$key
,
$group
=
''
)
{
...
...
@@ -102,6 +112,9 @@ function wp_cache_get( $key, $group = '' ) {
* Mirrors the Memcached Object Cache plugin's argument and return-value formats
*
* @param array $groups Array of groups and keys to retrieve
*
* @global WP_Object_Cache $wp_object_cache
*
* @return bool|mixed Array of cached values, keys in the format $group:$key. Non-existent keys false
*/
function
wp_cache_get_multi
(
$groups
)
{
...
...
@@ -116,6 +129,8 @@ function wp_cache_get_multi( $groups ) {
* @param int $offset The amount by which to increment the item's value.
* @param string $group The group value appended to the $key.
*
* @global WP_Object_Cache $wp_object_cache
*
* @return int|bool Returns item's new value on success or FALSE on failure.
*/
function
wp_cache_incr
(
$key
,
$offset
=
1
,
$group
=
''
)
{
...
...
@@ -127,6 +142,7 @@ function wp_cache_incr( $key, $offset = 1, $group = '' ) {
* Sets up Object Cache Global and assigns it.
*
* @global WP_Object_Cache $wp_object_cache WordPress Object Cache
*
* @return void
*/
function
wp_cache_init
()
{
...
...
@@ -145,6 +161,8 @@ function wp_cache_init() {
* @param string $group The group value appended to the $key.
* @param int $expiration The expiration time, defaults to 0.
*
* @global WP_Object_Cache $wp_object_cache
*
* @return bool Returns TRUE on success or FALSE on failure.
*/
function
wp_cache_replace
(
$key
,
$value
,
$group
=
''
,
$expiration
=
0
)
{
...
...
@@ -162,6 +180,8 @@ function wp_cache_replace( $key, $value, $group = '', $expiration = 0 ) {
* @param string $group The group value appended to the $key.
* @param int $expiration The expiration time, defaults to 0.
*
* @global WP_Object_Cache $wp_object_cache
*
* @return bool Returns TRUE on success or FALSE on failure.
*/
function
wp_cache_set
(
$key
,
$value
,
$group
=
''
,
$expiration
=
0
)
{
...
...
@@ -175,6 +195,9 @@ function wp_cache_set( $key, $value, $group = '', $expiration = 0 ) {
* This changes the blog id used to create keys in blog specific groups.
*
* @param int $_blog_id Blog ID
*
* @global WP_Object_Cache $wp_object_cache
*
* @return bool
*/
function
wp_cache_switch_to_blog
(
$_blog_id
)
{
...
...
@@ -187,6 +210,8 @@ function wp_cache_switch_to_blog( $_blog_id ) {
*
* @param string|array $groups A group or an array of groups to add.
*
* @global WP_Object_Cache $wp_object_cache
*
* @return void
*/
function
wp_cache_add_global_groups
(
$groups
)
{
...
...
@@ -199,6 +224,8 @@ function wp_cache_add_global_groups( $groups ) {
*
* @param string|array $groups A group or an array of groups to add.
*
* @global WP_Object_Cache $wp_object_cache
*
* @return void
*/
function
wp_cache_add_non_persistent_groups
(
$groups
)
{
...
...
@@ -623,7 +650,7 @@ class WP_Object_Cache {
// If group is a non-Redis group, save to internal cache, not Redis
if
(
in_array
(
$group
,
$this
->
no_redis_groups
)
||
!
$this
->
can_redis
()
)
{
$value
=
$this
->
get_from_internal_cache
(
$derived_key
);
$value
=
$this
->
get_from_internal_cache
(
$derived_key
,
$group
);
$value
+=
$offset
;
$this
->
add_to_internal_cache
(
$derived_key
,
$value
);
...
...
@@ -652,7 +679,7 @@ class WP_Object_Cache {
// If group is a non-Redis group, save to internal cache, not Redis
if
(
in_array
(
$group
,
$this
->
no_redis_groups
)
||
!
$this
->
can_redis
()
)
{
$value
=
$this
->
get_from_internal_cache
(
$derived_key
);
$value
=
$this
->
get_from_internal_cache
(
$derived_key
,
$group
);
$value
-=
$offset
;
$this
->
add_to_internal_cache
(
$derived_key
,
$value
);
...
...
This diff is collapsed.
Click to expand it.
readme.txt
+
6
−
6
View file @
7b2d176a
=== Redis Object Cache ===
Contributors: ericmann, ethitter
Tags: cache, object cache, redis
Contributors:
ericmann, ethitter
Tags:
cache, object cache, redis
Requires at least: 3.0.1
Tested up to: 3.9
Stable tag: 1.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tested up to:
3.9
Stable tag:
1.0
License:
GPLv2 or later
License URI:
http://www.gnu.org/licenses/gpl-2.0.html
A persistent object cache powered by Redis.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment