mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Update cache code to INI style configuration
Change the defines to config_get and add one cache option and one option to define memcache_servers. Mention the required dependency to get memcached working in the INSTALL file. Signed-off-by: Jelle van der Waa <jelle@vdwaa.nl> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
parent
c3bca45973
commit
ca6332de6e
3 changed files with 12 additions and 7 deletions
|
@ -1,22 +1,18 @@
|
|||
<?php
|
||||
|
||||
if (!defined('CACHE_TYPE')) {
|
||||
define('CACHE_TYPE', 'NONE');
|
||||
}
|
||||
|
||||
# Check if APC extension is loaded, and set cache prefix if it is.
|
||||
if (CACHE_TYPE == 'APC' && !defined('EXTENSION_LOADED_APC')) {
|
||||
if (config_get('options', 'cache') == 'apc' && !defined('EXTENSION_LOADED_APC')) {
|
||||
define('EXTENSION_LOADED_APC', extension_loaded('apc'));
|
||||
define('CACHE_PREFIX', 'aur:');
|
||||
}
|
||||
|
||||
# Check if memcache extension is loaded, and set cache prefix if it is.
|
||||
if (CACHE_TYPE == 'MEMCACHE' && !defined('EXTENSION_LOADED_MEMCACHE')) {
|
||||
if (config_get('options', 'cache') == 'memcache' && !defined('EXTENSION_LOADED_MEMCACHE')) {
|
||||
define('EXTENSION_LOADED_MEMCACHE', extension_loaded('memcached'));
|
||||
define('CACHE_PREFIX', 'aur:');
|
||||
global $memcache;
|
||||
$memcache = new Memcached();
|
||||
$mcs = defined('MEMCACHE_SERVERS') ? MEMCACHE_SERVERS : '127.0.0.1:11211';
|
||||
$mcs = config_get('options', 'memcache_servers');
|
||||
foreach (explode(',', $mcs) as $elem) {
|
||||
$telem = trim($elem);
|
||||
$mcserver = explode(':', $telem);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue