mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-12-25 06:27:03 +01:00
Remove beaker cache for now...
This commit is contained in:
parent
3186267510
commit
972063ad18
@ -2,6 +2,4 @@ flask
|
|||||||
flask-sqlalchemy
|
flask-sqlalchemy
|
||||||
flask_limiter
|
flask_limiter
|
||||||
requests_oauthlib
|
requests_oauthlib
|
||||||
mysql-python
|
|
||||||
Flask-SSLify
|
Flask-SSLify
|
||||||
beaker
|
|
||||||
|
@ -2,7 +2,7 @@ from config import config
|
|||||||
from database import db
|
from database import db
|
||||||
from flask import Flask, render_template, request, session, url_for, redirect, jsonify
|
from flask import Flask, render_template, request, session, url_for, redirect, jsonify
|
||||||
from flask_sslify import SSLify
|
from flask_sslify import SSLify
|
||||||
from titanembeds.utils import rate_limiter, cache, discord_api
|
from titanembeds.utils import rate_limiter, discord_api
|
||||||
import blueprints.api
|
import blueprints.api
|
||||||
import blueprints.user
|
import blueprints.user
|
||||||
import blueprints.embed
|
import blueprints.embed
|
||||||
|
@ -2,7 +2,6 @@ import requests
|
|||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import json
|
import json
|
||||||
from titanembeds.utils import cache
|
|
||||||
from titanembeds.database import db, KeyValueProperties, get_keyvalproperty, set_keyvalproperty, ifexists_keyvalproperty
|
from titanembeds.database import db, KeyValueProperties, get_keyvalproperty, set_keyvalproperty, ifexists_keyvalproperty
|
||||||
from flask import request
|
from flask import request
|
||||||
|
|
||||||
@ -133,7 +132,6 @@ class DiscordREST:
|
|||||||
# Widget Handler
|
# Widget Handler
|
||||||
#####################
|
#####################
|
||||||
|
|
||||||
@cache.cache('get_widget', expire=200)
|
|
||||||
def get_widget(self, guild_id):
|
def get_widget(self, guild_id):
|
||||||
_endpoint = _DISCORD_API_BASE + "/servers/{guild_id}/widget.json".format(guild_id=guild_id)
|
_endpoint = _DISCORD_API_BASE + "/servers/{guild_id}/widget.json".format(guild_id=guild_id)
|
||||||
embed = self.get_guild_embed(guild_id)
|
embed = self.get_guild_embed(guild_id)
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
from config import config
|
from config import config
|
||||||
from requests_oauthlib import OAuth2Session
|
from requests_oauthlib import OAuth2Session
|
||||||
from titanembeds.utils import cache, make_guilds_cache_key
|
|
||||||
from flask import session, abort, url_for
|
from flask import session, abort, url_for
|
||||||
|
|
||||||
authorize_url = "https://discordapp.com/api/oauth2/authorize"
|
authorize_url = "https://discordapp.com/api/oauth2/authorize"
|
||||||
@ -42,7 +41,6 @@ def get_current_authenticated_user():
|
|||||||
def user_has_permission(permission, index):
|
def user_has_permission(permission, index):
|
||||||
return bool((int(permission) >> index) & 1)
|
return bool((int(permission) >> index) & 1)
|
||||||
|
|
||||||
@cache.cache(make_guilds_cache_key, expire=120)
|
|
||||||
def get_user_guilds():
|
def get_user_guilds():
|
||||||
req = discordrest_from_user("/users/@me/guilds")
|
req = discordrest_from_user("/users/@me/guilds")
|
||||||
return req
|
return req
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
from beaker.cache import CacheManager
|
|
||||||
from beaker.util import parse_cache_config_options
|
|
||||||
from titanembeds.database import db, Guilds, KeyValueProperties
|
from titanembeds.database import db, Guilds, KeyValueProperties
|
||||||
from flask import request, session
|
from flask import request, session
|
||||||
from flask_limiter import Limiter
|
from flask_limiter import Limiter
|
||||||
@ -8,14 +6,6 @@ import random
|
|||||||
import string
|
import string
|
||||||
import hashlib
|
import hashlib
|
||||||
|
|
||||||
cache_opts = {
|
|
||||||
'cache.type': 'ext:database',
|
|
||||||
'cache.lock_dir': 'tmp/cachelock',
|
|
||||||
'cache.url': config["database-uri"],
|
|
||||||
'cache.sa.pool_recycle': 250,
|
|
||||||
}
|
|
||||||
cache = CacheManager(**parse_cache_config_options(cache_opts))
|
|
||||||
|
|
||||||
from titanembeds.discordrest import DiscordREST
|
from titanembeds.discordrest import DiscordREST
|
||||||
|
|
||||||
discord_api = DiscordREST(config['bot-token'])
|
discord_api = DiscordREST(config['bot-token'])
|
||||||
|
Loading…
Reference in New Issue
Block a user