Skip to content

Commit

Permalink
Hax
Browse files Browse the repository at this point in the history
  • Loading branch information
coleifer committed Jan 12, 2015
1 parent 5f1964d commit e533625
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion walrus/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def bust(*args, **kwargs):
return self.delete(key_fn(args, kwargs))
@wraps(fn)
def inner(*args, **kwargs):
key = key_fn(args, kwargs)
key = '%s:%s' % (fn.__name__, key_fn(args, kwargs))
res = self.get(key)
if res is None:
res = fn(*args, **kwargs)
Expand Down
10 changes: 7 additions & 3 deletions walrus/containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ def lex_count(self, low, high):
"""
return self.database.zlexcount(self.key, low, high)

def range(self, low, high, with_scores=False, reverse=False):
def range(self, low, high, with_scores=False, desc=False, reverse=False):
"""
Return a range of items between ``low`` and ``high``. By
default scores will not be included, but this can be controlled
Expand All @@ -564,9 +564,13 @@ def range(self, low, high, with_scores=False, reverse=False):
:param high: Upper bound.
:param bool with_scores: Whether the range should include the
scores along with the items.
:param bool reverse: Whether to return the range in reverse.
:param bool desc: Whether to sort the results descendingly.
:param bool reverse: Whether to select the range in reverse.
"""
return self.database.zrange(self.key, low, high, reverse, with_scores)
if reverse:
return self.database.zrevrange(self.key, low, high, with_scores)
else:
return self.database.zrange(self.key, low, high, desc, with_scores)

def range_by_score(self, low, high, start=None, num=None,
with_scores=False, reverse=False):
Expand Down

0 comments on commit e533625

Please sign in to comment.