forked from jb076/django-cache-helper
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from Jakeway/check_for_obj_get_cache_key
Add CacheHelperCacheable Interface; Clean up existing code
- Loading branch information
Showing
5 changed files
with
427 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
class CacheHelperException(Exception): | ||
pass | ||
pass | ||
|
||
|
||
class CacheKeyCreationError(CacheHelperException): | ||
pass | ||
pass | ||
|
||
|
||
class CacheHelperFunctionError(CacheHelperException): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import abc | ||
|
||
|
||
class CacheHelperCacheable(abc.ABC): | ||
@abc.abstractmethod | ||
def get_cache_helper_key(self): | ||
""" | ||
For any two objects of the same class which are considered equal in your application, | ||
get_cache_helper_key should return the same key. This key should be unique to all objects | ||
considered equal. This key will be used as a component to the final cache key to get/set | ||
values from the cache. The key should be a string. | ||
""" | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.