Commit 18ef21f1 authored by 吴升宇's avatar 吴升宇

Merge branch 'wsy3' into 'master'

add redis inrc

See merge request !576
parents ab4d0a9b 5ed24fbc
......@@ -118,7 +118,7 @@ def logins(user_id):
def click(cookies_get, id):
try:
click_key = 'click topic_id:%s, cookies_get: %s' % (str(cookies_get), str(id))
cache_count = click_cache.inrc(click_key, 1)
cache_count = click_cache.incr(click_key, 1)
click_cache.expire(click_key, settings.CACHE_SECONDS)
if cache_count > 1:
return
......@@ -161,7 +161,7 @@ def click(cookies_get, id):
def reply(cookies_get, id, content):
try:
reply_key = 'click topic_id:%s, cookies_get: %s, content:%s' % (str(id), str(cookies_get), str(content))
cache_count = click_cache.inrc(reply_key, 1)
cache_count = click_cache.incr(reply_key, 1)
reply_cache.expire(reply_key, settings.CACHE_SECONDS)
if cache_count > 1:
return
......@@ -294,7 +294,7 @@ def get_comments():
def follow(cookies_get, id):
try:
follow_key = 'click user_id:%s, cookies_get: %s' % (str(id), str(cookies_get))
cache_count = click_cache.inrc(follow_key, 1)
cache_count = click_cache.incr(follow_key, 1)
follow_cache.expire(follow_key, settings.CACHE_SECONDS)
if cache_count > 1:
return
......@@ -470,7 +470,7 @@ def reply2(cookies_get, id, content, replied_id):
try:
reply_key = 'click topic_id:%s, cookies_get: %s, content:%s, replied_id: %s' % \
(str(id), str(cookies_get), str(content), str(replied_id))
cache_count = click_cache.inrc(reply_key, 1)
cache_count = click_cache.incr(reply_key, 1)
reply_cache.expire(reply_key, settings.CACHE_SECONDS)
if cache_count > 1:
return
......@@ -500,7 +500,7 @@ def reply2(cookies_get, id, content, replied_id):
def pictorial_reply(cookies_get, id, content):
try:
reply_key = 'click topic_id:%s, cookies_get: %s, content:%s' % (str(id), str(cookies_get), str(content))
cache_count = click_cache.inrc(reply_key, 1)
cache_count = click_cache.incr(reply_key, 1)
reply_cache.expire(reply_key, settings.CACHE_SECONDS)
if cache_count > 1:
return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment