14 lines
271 B
Python
14 lines
271 B
Python
from apps.appsetting.models import City
|
|
from django.core.cache import cache
|
|
|
|
|
|
def get_city_list():
|
|
city = cache.get('city')
|
|
|
|
if city is None:
|
|
city = City.objects.all()
|
|
# 75 hour cache
|
|
cache.set('city', city, 60 * 60 * 72)
|
|
|
|
return city
|