Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
circlestack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
5931dc72
authored
Nov 18, 2013
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
common: add logging to method_cache
parent
93a898e7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
circle/common/models.py
+6
-0
No files found.
circle/common/models.py
View file @
5931dc72
from
hashlib
import
sha224
from
hashlib
import
sha224
from
logging
import
getLogger
from
time
import
time
from
time
import
time
from
django.contrib.auth.models
import
User
from
django.contrib.auth.models
import
User
...
@@ -9,6 +10,8 @@ from django.utils.translation import ugettext_lazy as _
...
@@ -9,6 +10,8 @@ from django.utils.translation import ugettext_lazy as _
from
model_utils.models
import
TimeStampedModel
from
model_utils.models
import
TimeStampedModel
logger
=
getLogger
(
__name__
)
def
activitycontextimpl
(
act
):
def
activitycontextimpl
(
act
):
try
:
try
:
...
@@ -105,6 +108,9 @@ def method_cache(memcached_seconds=60, instance_seconds=5): # noqa
...
@@ -105,6 +108,9 @@ def method_cache(memcached_seconds=60, instance_seconds=5): # noqa
# save to memcache and class attr
# save to memcache and class attr
cache
.
set
(
key
,
result
,
memcached_seconds
)
cache
.
set
(
key
,
result
,
memcached_seconds
)
setattr
(
instance
,
key
,
{
'time'
:
now
,
'value'
:
result
})
setattr
(
instance
,
key
,
{
'time'
:
now
,
'value'
:
result
})
logger
.
debug
(
'Value of <
%
s>.
%
s(
%
s)=<
%
s> saved to cache.'
,
unicode
(
instance
),
method
.
__name__
,
unicode
(
args
),
unicode
(
result
))
return
result
return
result
return
x
return
x
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment