From 972063ad18e80bdbc731db9eaf87df6d545d5541 Mon Sep 17 00:00:00 2001 From: Jeremy Zhang Date: Mon, 8 May 2017 21:09:11 -0700 Subject: [PATCH] Remove beaker cache for now... --- webapp/requirements.txt | 2 -- webapp/titanembeds/app.py | 2 +- webapp/titanembeds/discordrest.py | 2 -- webapp/titanembeds/oauth.py | 2 -- webapp/titanembeds/utils.py | 10 ---------- 5 files changed, 1 insertion(+), 17 deletions(-) diff --git a/webapp/requirements.txt b/webapp/requirements.txt index 6039554..402aba3 100644 --- a/webapp/requirements.txt +++ b/webapp/requirements.txt @@ -2,6 +2,4 @@ flask flask-sqlalchemy flask_limiter requests_oauthlib -mysql-python Flask-SSLify -beaker diff --git a/webapp/titanembeds/app.py b/webapp/titanembeds/app.py index 40f5b27..87726d7 100644 --- a/webapp/titanembeds/app.py +++ b/webapp/titanembeds/app.py @@ -2,7 +2,7 @@ from config import config from database import db from flask import Flask, render_template, request, session, url_for, redirect, jsonify 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.user import blueprints.embed diff --git a/webapp/titanembeds/discordrest.py b/webapp/titanembeds/discordrest.py index 99ad63d..5414203 100644 --- a/webapp/titanembeds/discordrest.py +++ b/webapp/titanembeds/discordrest.py @@ -2,7 +2,6 @@ import requests import sys import time import json -from titanembeds.utils import cache from titanembeds.database import db, KeyValueProperties, get_keyvalproperty, set_keyvalproperty, ifexists_keyvalproperty from flask import request @@ -133,7 +132,6 @@ class DiscordREST: # Widget Handler ##################### - @cache.cache('get_widget', expire=200) def get_widget(self, guild_id): _endpoint = _DISCORD_API_BASE + "/servers/{guild_id}/widget.json".format(guild_id=guild_id) embed = self.get_guild_embed(guild_id) diff --git a/webapp/titanembeds/oauth.py b/webapp/titanembeds/oauth.py index 9bb1332..dffeab8 100644 --- a/webapp/titanembeds/oauth.py +++ b/webapp/titanembeds/oauth.py @@ -1,6 +1,5 @@ from config import config from requests_oauthlib import OAuth2Session -from titanembeds.utils import cache, make_guilds_cache_key from flask import session, abort, url_for authorize_url = "https://discordapp.com/api/oauth2/authorize" @@ -42,7 +41,6 @@ def get_current_authenticated_user(): def user_has_permission(permission, index): return bool((int(permission) >> index) & 1) -@cache.cache(make_guilds_cache_key, expire=120) def get_user_guilds(): req = discordrest_from_user("/users/@me/guilds") return req diff --git a/webapp/titanembeds/utils.py b/webapp/titanembeds/utils.py index 30fb376..6e716cd 100644 --- a/webapp/titanembeds/utils.py +++ b/webapp/titanembeds/utils.py @@ -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 flask import request, session from flask_limiter import Limiter @@ -8,14 +6,6 @@ import random import string 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 discord_api = DiscordREST(config['bot-token'])