Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
2eb3f376
Commit
2eb3f376
authored
Aug 22, 2012
by
Calen Pennington
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #498 from MITx/feature/victor/domain-specific-caching
Separate caches per-domain-name
parents
f580bafd
ce0bc1f7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletions
+5
-1
common/djangoapps/util/cache.py
+5
-1
No files found.
common/djangoapps/util/cache.py
View file @
2eb3f376
...
...
@@ -9,6 +9,7 @@ from functools import wraps
from
django.core
import
cache
# If we can't find a 'general' CACHE defined in settings.py, we simply fall back
# to returning the default cache. This will happen with dev machines.
try
:
...
...
@@ -41,7 +42,10 @@ def cache_if_anonymous(view_func):
def
_decorated
(
request
,
*
args
,
**
kwargs
):
if
not
request
.
user
.
is_authenticated
():
#Use the cache
cache_key
=
"cache_if_anonymous."
+
request
.
path
# same view accessed through different domain names may
# return different things, so include the domain name in the key.
domain
=
str
(
request
.
META
.
get
(
'HTTP_HOST'
))
+
'.'
cache_key
=
domain
+
"cache_if_anonymous."
+
request
.
path
response
=
cache
.
get
(
cache_key
)
if
not
response
:
response
=
view_func
(
request
,
*
args
,
**
kwargs
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment