-
-
Notifications
You must be signed in to change notification settings - Fork 150
/
redis-cache.php
65 lines (54 loc) · 1.9 KB
/
redis-cache.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
/**
* Plugin Name: Redis Object Cache
* Plugin URI: https://wordpress.org/plugins/redis-cache/
* Description: A persistent object cache backend powered by Redis. Supports Predis, PhpRedis, Relay, replication, sentinels, clustering and WP-CLI.
* Version: 2.5.4
* Text Domain: redis-cache
* Domain Path: /languages
* Network: true
* Requires PHP: 7.2
* Author: Till Krüss
* Author URI: https://objectcache.pro
* GitHub Plugin URI: https://github.com/rhubarbgroup/redis-cache
* License: GPLv3
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
*
* @package RhubarbGroup/RedisCache
*/
defined( 'ABSPATH' ) || exit;
define( 'WP_REDIS_FILE', __FILE__ );
define( 'WP_REDIS_BASENAME', plugin_basename( WP_REDIS_FILE ) );
define( 'WP_REDIS_PLUGIN_DIR', plugin_dir_url( WP_REDIS_FILE ) );
if ( ! defined( 'WP_REDIS_PLUGIN_PATH' ) ) {
define( 'WP_REDIS_PLUGIN_PATH', __DIR__ );
}
$meta = get_file_data( WP_REDIS_FILE, [ 'Version' => 'Version' ] );
define( 'WP_REDIS_VERSION', $meta['Version'] );
require_once WP_REDIS_PLUGIN_PATH . '/includes/class-autoloader.php';
$autoloader = new Rhubarb\RedisCache\Autoloader();
$autoloader->register();
$autoloader->add_namespace( 'Rhubarb\RedisCache', WP_REDIS_PLUGIN_PATH . '/includes' );
if ( defined( 'WP_CLI' ) && WP_CLI && ! defined( 'RedisCachePro\Version' ) && ! defined( 'ObjectCachePro\Version' ) ) {
add_action(
'plugins_loaded',
function () {
WP_CLI::add_command( 'redis', Rhubarb\RedisCache\CLI\Commands::class );
}
);
}
register_activation_hook(
WP_REDIS_FILE,
[ Rhubarb\RedisCache\Plugin::class, 'on_activation' ]
);
Rhubarb\RedisCache\Plugin::instance();
if ( ! function_exists( 'redis_object_cache' ) ) {
/**
* Returns the plugin instance.
*
* @return Rhubarb\RedisCache\Plugin
*/
function redis_object_cache() {
return Rhubarb\RedisCache\Plugin::instance();
}
}