Skip to content

Commit

Permalink
Merge pull request #84 from ccnmtl/cache-bugfix
Browse files Browse the repository at this point in the history
Fix bug where cached value wasn't used when value was 0
  • Loading branch information
thraxil committed May 4, 2015
2 parents 79969a7 + 4b3569c commit 55525ec
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
1.1.3
==================
* Fixed a bug that prevented cached values from getting used,
if the value was 0.

1.1.2 (2015-04-22)
==================
* Add confirmation page when deleting a pageblock.
Expand Down
6 changes: 3 additions & 3 deletions pagetree/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def is_first_child(self):
def is_last_child(self):
key = "pagetree.%d.is_last_child" % self.id
v = cache.get(key)
if v:
if v is not None:
statsd.incr("pagetree.is_last_child.cache_hit")
return v
statsd.incr("pagetree.is_last_child.cache_miss")
Expand Down Expand Up @@ -287,7 +287,7 @@ def __unicode__(self):
def get_absolute_url(self):
key = "pagetree.%d.get_absolute_url" % self.id
v = cache.get(key)
if v:
if v is not None:
statsd.incr("pagetree.get_absolute_url.cache_hit")
return v
statsd.incr("pagetree.get_absolute_url.cache_miss")
Expand All @@ -307,7 +307,7 @@ def _get_absolute_url(self):
def get_edit_url(self):
key = "pagetree.%d.get_edit_url" % self.id
v = cache.get(key)
if v:
if v is not None:
statsd.incr("pagetree.get_edit_url.cache_hit")
return v
statsd.incr("pagetree.get_edit_url.cache_miss")
Expand Down

0 comments on commit 55525ec

Please sign in to comment.