Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ayush Tiwari
erp5
Commits
16274e10
Commit
16274e10
authored
Dec 31, 2012
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drop duplicate/obvious docstrings.
parent
f18bae34
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
24 deletions
+0
-24
product/ERP5Type/Tool/MemcachedTool.py
product/ERP5Type/Tool/MemcachedTool.py
+0
-24
No files found.
product/ERP5Type/Tool/MemcachedTool.py
View file @
16274e10
...
@@ -201,15 +201,9 @@ if memcache is not None:
...
@@ -201,15 +201,9 @@ if memcache is not None:
self
.
local_cache
[
key
]
=
None
self
.
local_cache
[
key
]
=
None
def
set
(
self
,
key
,
value
):
def
set
(
self
,
key
,
value
):
"""
Set an item to local cache and schedule update of memcached.
"""
return
self
.
__setitem__
(
key
,
value
)
return
self
.
__setitem__
(
key
,
value
)
def
get
(
self
,
key
,
default
=
None
):
def
get
(
self
,
key
,
default
=
None
):
"""
Get an item from local cache, otherwise from memcached.
"""
try
:
try
:
return
self
.
__getitem__
(
key
)
return
self
.
__getitem__
(
key
)
except
KeyError
:
except
KeyError
:
...
@@ -233,29 +227,17 @@ if memcache is not None:
...
@@ -233,29 +227,17 @@ if memcache is not None:
self
.
prefix
=
prefix
self
.
prefix
=
prefix
def
_prefixKey
(
self
,
key
):
def
_prefixKey
(
self
,
key
):
"""
Prefix key with self.prefix .
"""
if
not
isinstance
(
key
,
basestring
):
if
not
isinstance
(
key
,
basestring
):
raise
TypeError
,
'Key %s is not a string. Only strings are supported as key in SharedDict'
%
(
repr
(
key
),
)
raise
TypeError
,
'Key %s is not a string. Only strings are supported as key in SharedDict'
%
(
repr
(
key
),
)
return
'%s_%s'
%
(
self
.
prefix
,
key
)
return
'%s_%s'
%
(
self
.
prefix
,
key
)
def
__getitem__
(
self
,
key
):
def
__getitem__
(
self
,
key
):
"""
Get item from memcached.
"""
return
self
.
_dictionary
.
__getitem__
(
self
.
_prefixKey
(
key
))
return
self
.
_dictionary
.
__getitem__
(
self
.
_prefixKey
(
key
))
def
__setitem__
(
self
,
key
,
value
):
def
__setitem__
(
self
,
key
,
value
):
"""
Put item in memcached.
"""
self
.
_dictionary
.
__setitem__
(
self
.
_prefixKey
(
key
),
value
)
self
.
_dictionary
.
__setitem__
(
self
.
_prefixKey
(
key
),
value
)
def
__delitem__
(
self
,
key
):
def
__delitem__
(
self
,
key
):
"""
Delete item from memcached.
"""
self
.
_dictionary
.
__delitem__
(
self
.
_prefixKey
(
key
))
self
.
_dictionary
.
__delitem__
(
self
.
_prefixKey
(
key
))
# These are the method names called by zope
# These are the method names called by zope
...
@@ -264,15 +246,9 @@ if memcache is not None:
...
@@ -264,15 +246,9 @@ if memcache is not None:
__guarded_delitem__
=
__delitem__
__guarded_delitem__
=
__delitem__
def
get
(
self
,
key
,
default
=
None
):
def
get
(
self
,
key
,
default
=
None
):
"""
Get item from memcached.
"""
return
self
.
_dictionary
.
get
(
self
.
_prefixKey
(
key
),
default
)
return
self
.
_dictionary
.
get
(
self
.
_prefixKey
(
key
),
default
)
def
set
(
self
,
key
,
value
):
def
set
(
self
,
key
,
value
):
"""
Put item in memcached.
"""
self
.
_dictionary
.
set
(
self
.
_prefixKey
(
key
),
value
)
self
.
_dictionary
.
set
(
self
.
_prefixKey
(
key
),
value
)
allow_class
(
SharedDict
)
allow_class
(
SharedDict
)
...
...
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