add --cache-expire-freq

This commit is contained in:
roberto@precise64
2012-04-06 16:09:58 +02:00
parent f79f7e44a7
commit d193d5572f
3 changed files with 5 additions and 1 deletions
+3 -1
View File
@@ -118,9 +118,11 @@ void *cache_sweeper_loop(void *noarg) {
sigfillset(&smask);
pthread_sigmask(SIG_BLOCK, &smask, NULL);
if (!uwsgi.cache_expire_freq) uwsgi.cache_expire_freq = 3;
// remove expired cache items TODO use rb_tree timeouts
for(;;) {
sleep(1);
sleep(uwsgi.cache_expire_freq);
for (i = 0; i < (int) uwsgi.cache_max_items; i++) {
uwsgi_wlock(uwsgi.cache_lock);
if (uwsgi.cache_items[i].expires) {
+1
View File
@@ -159,6 +159,7 @@ static struct uwsgi_option uwsgi_base_options[] = {
{"cache-server", required_argument, 0, "enable the threaded cache server", uwsgi_opt_set_str, &uwsgi.cache_server, 0},
{"cache-server-threads", required_argument, 0, "set the number of threads for the cache server", uwsgi_opt_set_int, &uwsgi.cache_server_threads,0},
{"cache-no-expire", required_argument, 0, "disable auto sweep of expired items", uwsgi_opt_true, &uwsgi.cache_no_expire,0},
{"cache-expire-freq", required_argument, 0, "set the frequency of cache sweeper scans (default 3 seconds)", uwsgi_opt_set_int, &uwsgi.cache_expire_freq,0},
{"queue", required_argument, 0, "enable shared queue", uwsgi_opt_set_int, &uwsgi.queue_size, 0},
{"queue-blocksize", required_argument, 0, "set queue blocksize", uwsgi_opt_set_int, &uwsgi.queue_store_sync, 0},
+1
View File
@@ -1573,6 +1573,7 @@ struct uwsgi_server {
size_t cache_filesize;
int cache_store_sync;
int cache_no_expire;
int cache_expire_freq;
char *cache_server;
int cache_server_threads;