def test_region_api(self): tempdir = gettempdir() backends = [ cache.MemoryRegion(100), cache.SQLiteRegion(path=os.path.join(tempdir, str(uuid4())), max_size=1024**2) ] for backend in backends: assert not backend.get('mykey')[0] backend.set('mykey', 1) assert backend.get('mykey') == (True, 1)
def test_region_api(): with tempfile.TemporaryDirectory() as tmpdir: backends = [cache.MemoryRegion(100)] # this specific backend test is currently broken on windows if not is_windows_platform(): backends.append(cache.DiskRegion(path=os.path.join(tmpdir, str(uuid4())), max_size=1024 ** 2, persistent=False)) for backend in backends: assert backend.get('mykey') == (False, None) backend.set('mykey', 1) assert backend.get('mykey') == (True, 1) # second set is ignored backend.set('mykey', 2) assert backend.get('mykey') == (True, 1)
def test_region_api(): with tempfile.TemporaryDirectory() as tmpdir: backends = [ cache.MemoryRegion(100), cache.DiskRegion(path=os.path.join(tmpdir, str(uuid4())), max_size=1024**2, persistent=False) ] for backend in backends: assert backend.get('mykey') == (False, None) backend.set('mykey', 1) assert backend.get('mykey') == (True, 1) # second set is ignored backend.set('mykey', 2) assert backend.get('mykey') == (True, 1)