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
6
INSTALL
6
INSTALL
|
@ -95,3 +95,9 @@ read the instructions below.
|
|||
}
|
||||
|
||||
Sample systemd unit files for fcgiwrap can be found under conf/.
|
||||
|
||||
10) If you want memcache to cache MySQL data.
|
||||
|
||||
# pacman -S php-memcached
|
||||
|
||||
And edit the configuration file to enabled memcache caching.
|
||||
|
|
|
@ -35,6 +35,9 @@ snapshot_uri = /cgit/aur.git/snapshot/%s.tar.gz
|
|||
enable-maintenance = 1
|
||||
maintenance-exceptions = 127.0.0.1
|
||||
render-comment-cmd = /usr/local/bin/aurweb-rendercomment
|
||||
# memcache or apc
|
||||
cache = none
|
||||
memcache_servers = 127.0.0.1:11211
|
||||
|
||||
[ratelimit]
|
||||
request_limit = 4000
|
||||
|
|
|
@ -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
Reference in a new issue