mirror of
https://github.com/alexgo-io/stacks-puppet-node.git
synced 2026-01-12 22:43:42 +08:00
added memcached timeout for search queries
This commit is contained in:
@@ -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
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user