Remove beaker cache for now...

This commit is contained in:
Jeremy Zhang 2017-05-08 21:09:11 -07:00
parent 3186267510
commit 972063ad18
5 changed files with 1 additions and 17 deletions

View File

@ -2,6 +2,4 @@ flask
flask-sqlalchemy
flask_limiter
requests_oauthlib
mysql-python
Flask-SSLify
beaker

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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'])