Example #1
0
 def test_cache_del(self):
     set_cached_setting("test_cache_del", "del")
     val = get_cached_setting("test_cache_del")
     self.assertEqual(val, "del")
     del_cached_setting("test_cache_del")
     val = get_cached_setting("test_cache_del")
     self.assertEqual(val, None)
 def test_cache_del(self):
     set_cached_setting('test_cache_del', 'del')
     val = get_cached_setting('test_cache_del')
     self.assertEqual(val, 'del')
     del_cached_setting('test_cache_del')
     val = get_cached_setting('test_cache_del')
     self.assertEqual(val, None)
Example #3
0
 def _get_from_database(name):
     try:
         setting_obj = Setting.objects.get(name=name)
         value = setting_obj.value
         set_cached_setting(name, value)
         return value
     except Setting.DoesNotExist:
         return None
Example #4
0
 def test_cache_set(self):
     set_cached_setting("test_cache_set", "set")
     val = get_cached_setting("test_cache_set")
     self.assertEqual(val, "set")
Example #5
0
 def test_cache_get(self):
     val = get_cached_setting("test_cache_get")
     self.assertEqual(val, None)
     set_cached_setting("test_cache_get", "get")
     val = get_cached_setting("test_cache_get")
     self.assertEqual(val, "get")
Example #6
0
def post_save_callback(sender, instance, **kwargs):
    if instance.name != instance.name_initial:
        del_cached_setting(instance.name_initial)
    set_cached_setting(instance.name, instance.value)
 def test_cache_set(self):
     set_cached_setting('test_cache_set', 'set')
     val = get_cached_setting('test_cache_set')
     self.assertEqual(val, 'set')
 def test_cache_get(self):
     val = get_cached_setting('test_cache_get')
     self.assertEqual(val, None)
     set_cached_setting('test_cache_get', 'get')
     val = get_cached_setting('test_cache_get')
     self.assertEqual(val, 'get')