diff options
author | Dan McGee <dan@archlinux.org> | 2014-10-19 18:12:58 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2014-10-19 18:12:58 -0500 |
commit | 7c46d07f6417382e560d32c361c94dd8f2b9ddb8 (patch) | |
tree | 7f383f165f7c295aabcacd591bb6f1f0594cb550 | |
parent | 1ff2e37e049004852681794537417a1947bf6f18 (diff) |
Use varied prime numbers for caching lengths
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r-- | devel/utils.py | 2 | ||||
-rw-r--r-- | main/templatetags/pgp.py | 2 | ||||
-rw-r--r-- | packages/views/__init__.py | 4 | ||||
-rw-r--r-- | public/views.py | 14 | ||||
-rw-r--r-- | urls.py | 17 |
5 files changed, 19 insertions, 20 deletions
diff --git a/devel/utils.py b/devel/utils.py index 340841f5..0cafbb59 100644 --- a/devel/utils.py +++ b/devel/utils.py @@ -9,7 +9,7 @@ from main.utils import cache_function from main.models import Package from packages.models import PackageRelation -@cache_function(300) +@cache_function(283) def get_annotated_maintainers(): maintainers = User.objects.filter(is_active=True).order_by( 'first_name', 'last_name') diff --git a/main/templatetags/pgp.py b/main/templatetags/pgp.py index cc080439..2417f688 100644 --- a/main/templatetags/pgp.py +++ b/main/templatetags/pgp.py @@ -44,7 +44,7 @@ def pgp_key_link(key_id, link_text=None): return '<a href="%s" title="PGP key search for %s">%s</a>' % values -@cache_function(1800) +@cache_function(1741) def name_for_key(normalized): try: matching_key = DeveloperKey.objects.select_related( diff --git a/packages/views/__init__.py b/packages/views/__init__.py index 46c99985..6b44206a 100644 --- a/packages/views/__init__.py +++ b/packages/views/__init__.py @@ -35,7 +35,7 @@ def opensearch(request): @require_safe -@cache_control(public=True, max_age=300) +@cache_control(public=True, max_age=613) def opensearch_suggest(request): search_term = request.GET.get('q', '') if search_term == '': @@ -55,7 +55,7 @@ def opensearch_suggest(request): 'pkgname', flat=True).order_by('pkgname').distinct()[:10] results = [search_term, list(names)] to_json = json.dumps(results, ensure_ascii=False) - cache.set(cache_key, to_json, 300) + cache.set(cache_key, to_json, 613) return HttpResponse(to_json, content_type='application/x-suggestions+json') diff --git a/public/views.py b/public/views.py index 3b23bd42..62d1137a 100644 --- a/public/views.py +++ b/public/views.py @@ -17,7 +17,7 @@ from releng.models import Release from .utils import get_recent_updates -@cache_control(max_age=300) +@cache_control(max_age=307) def index(request): if request.user.is_authenticated(): def updates(): @@ -50,7 +50,7 @@ USER_LISTS = { } -@cache_control(max_age=300) +@cache_control(max_age=307) def userlist(request, user_type='devs'): users = User.objects.order_by( 'first_name', 'last_name').select_related('userprofile') @@ -70,7 +70,7 @@ def userlist(request, user_type='devs'): return render(request, 'public/userlist.html', context) -@cache_control(max_age=300) +@cache_control(max_age=307) def donate(request): context = { 'donors': Donor.objects.filter(visible=True).order_by('name'), @@ -88,7 +88,7 @@ def _mirror_urls(): return sorted(urls, key=sort_by) -@cache_control(max_age=300) +@cache_control(max_age=307) def download(request): try: release = Release.objects.filter(available=True).latest() @@ -104,7 +104,7 @@ def download(request): return render(request, 'public/download.html', context) -@cache_control(max_age=300) +@cache_control(max_age=307) def feeds(request): repos = Repo.objects.all() if not request.user.is_authenticated(): @@ -116,7 +116,7 @@ def feeds(request): return render(request, 'public/feeds.html', context) -@cache_control(max_age=300) +@cache_control(max_age=307) def keys(request): users = User.objects.filter(is_active=True).select_related( 'userprofile__pgp_key').order_by('first_name', 'last_name') @@ -153,7 +153,7 @@ def keys(request): return render(request, 'public/keys.html', context) -@cache_page(1800) +@cache_page(1789) def keys_json(request): node_list = [] @@ -41,20 +41,19 @@ urlpatterns += patterns('public.views', # Feeds patterns, used below feeds_patterns = patterns('', (r'^$', 'public.views.feeds', {}, 'feeds-list'), - (r'^news/$', cache_page(300)(NewsFeed())), - (r'^packages/$', cache_page(300)(PackageFeed())), + (r'^news/$', cache_page(311)(NewsFeed())), + (r'^packages/$', cache_page(313)(PackageFeed())), (r'^packages/(?P<arch>[A-z0-9]+)/$', - cache_page(300)(PackageFeed())), + cache_page(313)(PackageFeed())), (r'^packages/all/(?P<repo>[A-z0-9\-]+)/$', - cache_page(300)(PackageFeed())), + cache_page(313)(PackageFeed())), (r'^packages/(?P<arch>[A-z0-9]+)/(?P<repo>[A-z0-9\-]+)/$', - cache_page(300)(PackageFeed())), - (r'^releases/$', cache_page(300)(ReleaseFeed())), + cache_page(313)(PackageFeed())), + (r'^releases/$', cache_page(317)(ReleaseFeed())), ) # Includes and other remaining stuff urlpatterns += patterns('', - # cache this static JS resource for 1 week rather than default 5 minutes (r'^admin/', include(admin.site.urls)), (r'^devel/', include('devel.urls')), (r'^feeds/', include(feeds_patterns)), @@ -80,10 +79,10 @@ urlpatterns += patterns('retro.views', # Sitemaps urlpatterns += patterns('', (r'^sitemap.xml$', - cache_page(1800)(sitemap_views.index), + cache_page(1831)(sitemap_views.index), {'sitemaps': our_sitemaps, 'sitemap_url_name': 'sitemaps'}), (r'^sitemap-(?P<section>.+)\.xml$', - cache_page(1800)(sitemap_views.sitemap), + cache_page(1831)(sitemap_views.sitemap), {'sitemaps': our_sitemaps}, 'sitemaps'), ) |