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
/* | |
Invariant: | |
String is subclass of Object but in java | |
List<String> is not a subclass of List<Object> | |
Covariant | |
String in scala is a subclass of Object | |
List[String] is a subclass of List[Object] |
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
from django.db import models | |
from caching.base import CachingMixing, CachingManager, CachingQuerySet | |
class OurModel(CachingMixin, models.Model): | |
data = models.IntegerField() | |
objects = CachedManager(default_from_cache=True, cache_timeout=1200) | |
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
from django.db import models | |
from caching.base import CachingManager, CachingMixin | |
class CacheIt(CachingMixin, models.Model): | |
key_data = models.CharField(max_length=30) | |
related_stuff = models.ForeignKey('related.RelatedStuff') | |
objects = CachingManager() |