diff --git a/.doreah b/.doreah index 4022ac8..9a545e6 100644 --- a/.doreah +++ b/.doreah @@ -1,4 +1,4 @@ logging.logfolder = logs settings.files = [ "settings/default.ini" , "settings/settings.ini" ] -caching.folder = "images/cached/" +caching.folder = "cache/" regular.autostart = false diff --git a/cache/.gitignore b/cache/.gitignore new file mode 100644 index 0000000..306625e --- /dev/null +++ b/cache/.gitignore @@ -0,0 +1,3 @@ +* +!.gitignore +!*.info diff --git a/database.py b/database.py index 0192c2d..130ece2 100644 --- a/database.py +++ b/database.py @@ -895,7 +895,7 @@ def sync(): import copy cache_query = {} -cache_query_permanent = Cache(maxsize=30000) +cache_query_permanent = Cache(maxmemory=1024*1024*settings.get_settings("DB_CACHE_SIZE"),persistent=True,name="dbcache_query") cacheday = (0,0,0) def db_query(**kwargs): check_cache_age() @@ -918,7 +918,7 @@ def db_query(**kwargs): return result cache_aggregate = {} -cache_aggregate_permanent = Cache(maxsize=30000) +cache_aggregate_permanent = Cache(maxmemory=1024*1024*settings.get_settings("DB_CACHE_SIZE"),persistent=True,name="dbcache_aggregate") def db_aggregate(**kwargs): check_cache_age() global cache_aggregate, cache_aggregate_permanent diff --git a/settings/default.ini b/settings/default.ini index cb5d737..9356980 100644 --- a/settings/default.ini +++ b/settings/default.ini @@ -6,12 +6,13 @@ API_PORT = 42011 [Third Party Services] LASTFM_API_KEY = "ASK" # "ASK" signifies that the user has not yet indicated to not use any key at all. - -[Cache] - CACHE_EXPIRE_NEGATIVE = 30 # after how many days negative results should be tried again CACHE_EXPIRE_POSITIVE = 300 # after how many days positive results should be refreshed +[Database] + +DB_CACHE_SIZE = 1024 # how many MB the database cache should have available. + [Local Images] USE_LOCAL_IMAGES = true diff --git a/utilities.py b/utilities.py index 5d894b0..4748952 100644 --- a/utilities.py +++ b/utilities.py @@ -206,8 +206,8 @@ def apirequest(artists=None,artist=None,title=None): cacheage = settings.get_settings("CACHE_EXPIRE_POSITIVE") * 24 * 3600 cacheage_neg = settings.get_settings("CACHE_EXPIRE_NEGATIVE") * 24 * 3600 -artist_cache = caching.Cache.create(name="artist_cache",maxage=cacheage,maxage_negative=cacheage_neg) -track_cache = caching.Cache.create(name="track_cache",maxage=cacheage,maxage_negative=cacheage_neg) +artist_cache = caching.Cache(name="imgcache_artists",maxage=cacheage,maxage_negative=cacheage_neg,persistent=True) +track_cache = caching.Cache(name="imgcache_tracks",maxage=cacheage,maxage_negative=cacheage_neg,persistent=True) # removes emojis and weird shit from names