Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
D
Django-Redis-Cache
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shared
Django-Redis-Cache
Commits
9b2dfcef
Commit
9b2dfcef
authored
Jul 15, 2015
by
Sean Bleier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove total_ordering.
parent
2c2ece78
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
15 deletions
+3
-15
single.py
redis_cache/backends/single.py
+0
-1
sharder.py
redis_cache/sharder.py
+3
-14
No files found.
redis_cache/backends/single.py
View file @
9b2dfcef
...
...
@@ -5,7 +5,6 @@ except ImportError:
import
random
from
redis_cache.backends.base
import
BaseRedisCache
from
redis_cache.compat
import
bytes_type
,
DEFAULT_TIMEOUT
class
RedisCache
(
BaseRedisCache
):
...
...
redis_cache/sharder.py
View file @
9b2dfcef
...
...
@@ -2,7 +2,6 @@ from bisect import insort, bisect
from
hashlib
import
md5
from
math
import
log
import
sys
from
functools
import
total_ordering
try
:
maxint
=
sys
.
maxint
...
...
@@ -16,27 +15,17 @@ def make_hash(s):
return
int
(
md5
(
s
.
encode
(
'utf-8'
))
.
hexdigest
()[:
DIGITS
],
16
)
@
total_ordering
class
Node
(
object
):
def
__init__
(
self
,
node
,
i
):
self
.
_node
=
node
self
.
_i
=
i
self
.
_position
=
make_hash
(
"{0}:{1}"
.
format
(
i
,
self
.
_node
))
def
__
l
t__
(
self
,
other
):
def
__
g
t__
(
self
,
other
):
if
isinstance
(
other
,
int
):
return
self
.
_position
<
other
return
self
.
_position
>
other
elif
isinstance
(
other
,
Node
):
return
self
.
_position
<
other
.
_position
raise
TypeError
(
'Cannot compare this class with "
%
s" type'
%
type
(
other
)
)
def
__eq__
(
self
,
other
):
if
isinstance
(
other
,
int
):
return
self
.
_node
==
other
elif
isinstance
(
other
,
Node
):
return
self
.
_node
==
other
.
_node
return
self
.
_position
>
other
.
_position
raise
TypeError
(
'Cannot compare this class with "
%
s" type'
%
type
(
other
)
)
...
...
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