def test_insert_1(self): key = 'xml-packages/27/rhn-package-78527.xml-alt' ts = 1056359720.0 content = "0123456789" * 100 rhnDatabaseCache.set(key, content, modified=ts, raw=1, compressed=1) val = rhnDatabaseCache.get(key, modified=ts, raw=1, compressed=1) self.assertEqual(val, content)
def cache_set(self, params, value): log_debug(4, params) last_modified = self._get_last_modified(params) key = self._get_key(params) if not self.use_database_cache: set_cache = rhnCache.set(key, value, modified=last_modified, \ raw=1, user='******', group='apache', mode=0755) return set_cache return rhnDatabaseCache.set(key, value, modified=last_modified, raw=1, compressed=1)
key = 'xml-packages/27/rhn-package-78527.xml-alt' ts = 1056359720.0 #key = 'xml-packages/27/rhn-package-78527.xml' if 1: if 1: data = rhnDatabaseCache.get(key, compressed=1, raw=1, modified=ts) else: data = rhnDatabaseCache.get(key, compressed=1, raw=1) if data is not None: print len(data) sys.exit(1) if 1: content = open("test/rhn-package-78527.xml").read() * 6 if 1: rhnDatabaseCache.set(key, content, compressed=1, raw=1, modified=ts) else: rhnDatabaseCache.set(key, content, compressed=1, raw=1) sys.exit(1) #ts = None compressed = 1 print "Original timestamp:", ts print "Has_key ts", rhnDatabaseCache.has_key('b', ts) if ts: print "Has_key ts-1", rhnDatabaseCache.has_key('b', ts-1) if 0: #val = '0123456789' * 5000 #val = open("/tmp/ggg.fff").read() #val = '0123456789' * 1024 * 100 * 48 val = '0123456789' * 1024 * 100 * 30