mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-12-24 14:07:03 +01:00
Change the cache key abit and extended cache time
This commit is contained in:
parent
ed0131fb10
commit
d29d70565d
@ -3,7 +3,7 @@ import json
|
||||
from requests_oauthlib import OAuth2Session
|
||||
from flask import session, abort, url_for
|
||||
from titanembeds.database import get_keyvalproperty, set_keyvalproperty
|
||||
from titanembeds.utils import make_cache_key
|
||||
from titanembeds.utils import make_user_cache_key
|
||||
|
||||
authorize_url = "https://discordapp.com/api/oauth2/authorize"
|
||||
token_url = "https://discordapp.com/api/oauth2/token"
|
||||
@ -52,7 +52,7 @@ def get_user_guilds():
|
||||
if req.status_code != 200:
|
||||
abort(req.status_code)
|
||||
req = json.dumps(req.json())
|
||||
set_keyvalproperty("OAUTH/USERGUILDS/"+make_cache_key(), req, 100)
|
||||
set_keyvalproperty("OAUTH/USERGUILDS/"+make_user_cache_key(), req, 250)
|
||||
return req
|
||||
|
||||
def get_user_managed_servers():
|
||||
|
@ -32,6 +32,11 @@ def make_cache_key(*args, **kwargs):
|
||||
sess = generate_session_key()
|
||||
return (path + args + sess + ip).encode('utf-8')
|
||||
|
||||
def make_user_cache_key(*args, **kwargs)
|
||||
ip = get_client_ipaddr()
|
||||
sess = generate_session_key()
|
||||
return (sess + ip).encode('utf-8')
|
||||
|
||||
def make_guilds_cache_key():
|
||||
sess = generate_session_key()
|
||||
ip = get_client_ipaddr()
|
||||
|
Loading…
Reference in New Issue
Block a user