If I only set and get David with version=0, then I can get John and David in order as shown below. *I use LocMemCache which is the default cache in Django and I'm learning Django Cache:
from django.core.cache import cache
cache.set("name", "John")
cache.set("name", "David", version=0)
print(cache.get("name")) # John
print(cache.get("name", version=0)) # David
And, if I only set and get David with version=2, then I can get John and David in order as well as shown below:
from django.core.cache import cache
cache.set("name", "John")
cache.set("name", "David", version=2)
print(cache.get("name")) # John
print(cache.get("name", version=2)) # David
But, if I only set and get David with version=1, then I can get David and David in order as shown below so this is because John is set with version=1 by default?:
from django.core.cache import cache
cache.set("name", "John")
cache.set("name", "David", version=1)
print(cache.get("name")) # David
print(cache.get("name", version=1)) # David
In addition, if I set and get John and David without version=1, then I can get David and David in order as well as shown below:
from django.core.cache import cache
cache.set("name", "John")
cache.set("name", "David")
print(cache.get("name")) # David
print(cache.get("name")) # David
I know that the doc shows version=None for cache.set() as shown below:
↓ ↓ Here ↓ ↓
cache.set(key, value, timeout=DEFAULT_TIMEOUT, version=None)
So, does cache.set() actually use version=1 by default instead of version=None in Django?