Permalink
Browse files

cache middleware, memcached

  • Loading branch information...
1 parent 381f623 commit 704dc13977f95a40560185d8f61bfcc5489cc6a1 @bryanhelmig bryanhelmig committed Dec 26, 2011
@@ -24,14 +24,17 @@
}
MIDDLEWARE_CLASSES = (
+ 'django.middleware.cache.UpdateCacheMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
+ 'django.middleware.cache.FetchFromCacheMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware',
)
+
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
@@ -61,6 +64,13 @@
# Make this unique, and don't share it with anybody.
SECRET_KEY = 'nds_$1_(f1=zw-56pl7z-91&=%^frf)#5l_1gb(bcog_))0@hh'
+CACHES = {
+ 'default': {
+ 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
+ 'LOCATION': '127.0.0.1:11211',
+ }
+}
+
if DEBUG:
# Show emails in the console during developement.
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
View
@@ -88,13 +88,20 @@
)
MIDDLEWARE_CLASSES = (
+ 'django.middleware.cache.UpdateCacheMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
+ 'django.middleware.cache.FetchFromCacheMiddleware',
)
+CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True
+CACHE_MIDDLEWARE_ALIAS = 'default'
+CACHE_MIDDLEWARE_SECONDS = 60 * 10
+CACHE_MIDDLEWARE_KEY_PREFIX = 'jazzchanges'
+
ROOT_URLCONF = 'jazzchanges.urls'
# Python dotted path to the WSGI application used by Django's runserver.
@@ -9,7 +9,7 @@
<br />
<div class="page-header">
- <h1>{{ tune.title }} <small><em>{{ tune.artist }}</em> <span class="smaller">key of</span> {{ letter_key }} <span class="smaller">&amp; in</span> {{ tune.get_time_display }} <span class="smaller">time</span></small>
+ <h1>{{ tune.title }} <small><em>{{ tune.artist }}</em> <span class="smaller">key of {{ letter_key }}</span></small>
{% if key != tune.key %}
<a class="btn small" href="{% url directory:view_key tune.id tune.artist_slug tune.title_slug key %}">Exit Fullscreen</a>
{% else %}
@@ -7,7 +7,7 @@
{% block inner_content %}
<div class="page-header">
- <h1>{{ tune.title }} <small><em>{{ tune.artist }}</em> <span class="smaller">key of</span> {{ letter_key }} <span class="smaller">&amp; in</span> {{ tune.get_time_display }} <span class="smaller">time</span></small>
+ <h1>{{ tune.title }} <small><em>{{ tune.artist }}</em> <span class="smaller">key of {{ letter_key }}</span></small>
<div class="dropdown" style="float:right" data-dropdown="dropdown">
<a class="btn success small dropdown-toggle" href="#">Transpose</a>
@@ -9,7 +9,7 @@
<br />
<div class="page-header">
- <h1>{{ tune.title }} <small><em>{{ tune.artist }}</em> <span class="smaller">key of</span> {{ letter_key }} <span class="smaller">&amp; in</span> {{ tune.get_time_display }} <span class="smaller">time</span></small>
+ <h1>{{ tune.title }} <small><em>{{ tune.artist }}</em> <span class="smaller">key of {{ letter_key }}</span></small>
{% if key != tune.key %}
<a class="btn small" href="{% url tunes:view_key tune.id key %}">Exit Fullscreen</a>
{% else %}
@@ -7,7 +7,7 @@
{% block inner_content %}
<div class="page-header">
- <h1>{{ tune.title }} <small><em>{{ tune.artist }}</em> <span class="smaller">key of</span> {{ letter_key }} <span class="smaller">&amp; in</span> {{ tune.get_time_display }} <span class="smaller">time</span></small>
+ <h1>{{ tune.title }} <small><em>{{ tune.artist }}</em> <span class="smaller">key of {{ letter_key }}</span></small>
<a class="btn primary small" href="{% url tunes:edit tune.id %}">Edit</a>
<div class="dropdown" style="float:right" data-dropdown="dropdown">
@@ -145,7 +145,7 @@ def __unicode__(self):
class ChangeManager(models.Manager):
def with_key(self, **kwargs):
key = kwargs.pop('key', None)
- qs = super(ChangeManager, self).get_query_set().filter(**kwargs)
+ qs = super(ChangeManager, self).get_query_set().select_related().filter(**kwargs)
[change.get_chord(key=key) for change in qs]
View
@@ -9,4 +9,5 @@ django-guardian==1.0.3
-e git+git@github.com:bryanhelmig/django-userena.git@6fbb5cf3a3a79484be0b033d7c4f9e3895d00779#egg=django_userena-dev
easy-thumbnails==1.0-alpha-21
psycopg2==2.4.4
+python-memcached==1.48
wsgiref==0.1.2

0 comments on commit 704dc13

Please sign in to comment.