added memcached timeout for search queries

This commit is contained in:
Muneeb Ali
2014-10-31 15:28:00 -04:00
parent ba43e35813
commit 27dfda661c
2 changed files with 5 additions and 3 deletions

View File

@@ -10,4 +10,5 @@ DEFAULT_PORT = 5000
DEFAULT_HOST = '127.0.0.1'
BULK_INSERT_LIMIT = 1000
DEFAULT_LIMIT = 50
DEFAULT_LIMIT = 50
MEMCACHED_TIMEOUT = 6 * 60 * 60

View File

@@ -12,8 +12,9 @@ from flask import request, jsonify, Flask, make_response
app = Flask(__name__)
from config import DEFAULT_HOST, DEFAULT_PORT, DEBUG
from config import DEFAULT_HOST, DEFAULT_PORT, DEBUG, MEMCACHED_TIMEOUT
import json
import time
from bson import json_util
import sys
@@ -184,7 +185,7 @@ def search_by_name():
results['results'] = results_people[:new_limit]
#print results
mc.set(cache_key,results)
mc.set(cache_key,results,int(time() + MEMCACHED_TIMEOUT))
return jsonify(results)