-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathredis.module
More file actions
112 lines (105 loc) · 4.09 KB
/
redis.module
File metadata and controls
112 lines (105 loc) · 4.09 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php
/**
* @file
* Redis module.
*
* This file is a placeholder for other modules that need the Redis client for
* something else than lock and cache.
*/
// Include our own autoloader to ensure classes to be there.
// We cannot rely on core in case of early bootstrap phases.
require_once dirname(__FILE__) . '/redis.autoload.inc';
/**
* Implements hook_menu().
*/
function redis_menu() {
$items = array();
$items['admin/config/development/performance/default'] = array(
'title' => "Performance",
'type' => MENU_DEFAULT_LOCAL_TASK,
'file path' => backdrop_get_path('module', 'system'),
'weight' => -10,
);
$items['admin/config/development/performance/redis'] = array(
'title' => "Redis",
'page callback' => 'backdrop_get_form',
'page arguments' => array('redis_settings_form'),
'access arguments' => array('administer site configuration'),
'type' => MENU_LOCAL_TASK,
'file' => 'redis.admin.inc',
'weight' => 1,
);
return $items;
}
/**
* Implements hook_config_info().
*/
function redis_config_info() {
$prefixes['redis.settings'] = array(
'label' => t('Redis module settings'),
'group' => t('Configuration'),
);
return $prefixes;
}
/**
* Get Redis client for php-redis extension.
*
* @return \Redis
*/
function phpredis_client_get() {
if ('PhpRedis' !== config_get('redis.settings', 'redis_client_interface')) {
throw new LogicException("Redis is not configured to use the php-redis client");
}
return Redis_Client::getClient();
}
/**
* Get Redis client for Predis library.
*
* @return \Predis\Client
*/
function predis_client_get() {
if ('Predis' !== config_get('redis.settings', 'redis_client_interface')) {
throw new LogicException("Redis is not configured to use the Predis client");
}
return Redis_Client::getClient();
}
/**
* Implements hook_autoload_info().
*/
function redis_autoload_info() {
return array(
'Redis_AbstractBackend' => 'lib/Redis/AbstractBackend.php',
'Redis_BackendInterface' => 'lib/Redis/BackendInterface.php',
'Redis_Cache_BackendInterface' => 'lib/Redis/Cache/BackendInterface.php',
'Redis_Cache_Base' => 'lib/Redis/Cache/Base.php',
'Redis_Cache_PhpRedis' => 'lib/Redis/Cache/PhpRedis.php',
'Redis_Cache_Predis' => 'lib/Redis/Cache/Predis.php',
'Redis_Cache' => 'lib/Redis/Cache.php',
'Redis_CacheCompressed' => 'lib/Redis/CacheCompressed.php',
'Redis_Client_FactoryInterface' => 'lib/Redis/Client/FactoryInterface.php',
'Redis_Client_Manager' => 'lib/Redis/Client/Manager.php',
'Redis_Client_PhpRedis' => 'lib/Redis/Client/PhpRedis.php',
'Redis_Client_Predis' => 'lib/Redis/Client/Predis.php',
'Redis_Client' => 'lib/Redis/Client.php',
'Redis_Lock_BackendInterface' => 'lib/Redis/Lock/BackendInterface.php',
'Redis_Lock_DefaultBackend' => 'lib/Redis/Lock/DefaultBackend.php',
'Redis_Lock_PhpRedis' => 'lib/Redis/Lock/PhpRedis.php',
'Redis_Lock_Predis' => 'lib/Redis/Lock/Predis.php',
'Redis_Lock' => 'lib/Redis/Lock.php',
'Redis_Path_AbstractHashLookup' => 'lib/Redis/Path/AbstractHashLookup.php',
'Redis_Path_HashLookupInterface' => 'lib/Redis/Path/HashLookupInterface.php',
'Redis_Path_NullHashLookup' => 'lib/Redis/Path/NullHashLookup.php',
'Redis_Path_PhpRedis' => 'lib/Redis/Path/PhpRedis.php',
'Redis_Path_Predis' => 'lib/Redis/Path/Predis.php',
'Redis_Queue_Base' => 'lib/Redis/Queue/Base.php',
'Redis_Queue_PhpRedis' => 'lib/Redis/Queue/PhpRedis.php',
'Redis_Queue' => 'lib/Redis/Queue.php',
'Redis_Tests_AbstractUnitTestCase' => 'lib/Redis/Tests/AbstractUnitTestCase.php',
'Redis_Tests_Cache_FixesUnitTestCase' => 'lib/Redis/Tests/Cache/FixesUnitTestCase.php',
'Redis_Tests_Cache_FlushUnitTestCase' => 'lib/Redis/Tests/Cache/FlushUnitTestCase.php',
'Redis_Tests_Client_MockFactory' => 'lib/Redis/Tests/Client/MockFactory.php',
'Redis_Tests_Lock_LockingUnitTestCase' => 'lib/Redis/Tests/Lock/LockingUnitTestCase.php',
'Redis_Tests_Path_PathUnitTestCase' => 'lib/Redis/Tests/Path/PathUnitTestCase.php',
'Redis_Tests_Queue_QueueUnitTestCase' => 'lib/Redis/Tests/Queue/QueueUnitTestCase.php',
);
}