Skip to content
This repository has been archived by the owner on Aug 11, 2024. It is now read-only.

Commit

Permalink
Tested this app with Django 1.0.x. The cache status fails silently if…
Browse files Browse the repository at this point in the history
… the project does not use memcached. Updated README.
  • Loading branch information
bartTC committed Apr 29, 2009
1 parent 95f741f commit f032e20
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
7 changes: 5 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ django-memcache-status
======================

This app displays the current load and some statistics for your memcached_
instances. At this time it's only tested with *Django 1.1* (django-trunk).
instances. It's tested with the current *Django 1.0.2* and *Django 1.1*
(django-trunk).

Installation
============

Put ``memcache_status`` in your ``INSTALLED_APPS``. That's all.
Put ``memcache_status`` in your ``INSTALLED_APPS``.

That's all. Only admin-users with ``superuser`` permission can see these stats.

Screenshots
===========
Expand Down
4 changes: 2 additions & 2 deletions memcache_status/templates/memcache_status/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
{% endblock %}

{% block content %}
{% if request.user.is_superuser %}
<div class="cache_stats">
{% get_cache_stats %}
{% if cache_stats and request.user.is_superuser %}
<div class="cache_stats">
{% for server in cache_stats %}
<div class="module">
<table>
Expand Down
7 changes: 6 additions & 1 deletion memcache_status/templatetags/memcache_status_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@

class CacheStats(template.Node):
def render(self, context):
context['cache_stats'] = sorted(cache._cache.get_stats())
try:
cache_stats = sorted(cache._cache.get_stats())
# The current cache backend does not provide any statistics
except AttributeError:
cache_stats = None
context['cache_stats'] = cache_stats
return ''

@register.tag
Expand Down

0 comments on commit f032e20

Please sign in to comment.