Skip to content

Instantly share code, notes, and snippets.

@mythz
Forked from alfredoPacheco/main.cs
Created July 1, 2020 13:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mythz/1beaff3196b884a5055a46f727918add to your computer and use it in GitHub Desktop.
Save mythz/1beaff3196b884a5055a46f727918add to your computer and use it in GitHub Desktop.
Redis Redis/Memory RemoveAll repro
using System;
using ServiceStack;
using ServiceStack.Text;
using ServiceStack.Redis;
using ServiceStack.DataAnnotations;
using ServiceStack.Caching;
var redisManager = new RedisManagerPool("localhost:6379");
var redis = redisManager.GetClient();
redis.FlushAll();
var cache = redisManager.GetCacheClient().WithPrefix("sample");
var memCache = new MemoryCacheClient().WithPrefix("sample");
cache.Set("siafracc_QUERY_Deposit__Query_Deposit_10_1", "A");
cache.Set("siafracc_QUERY_Deposit__0_1___CUSTOM", "B");
memCache.Set("siafracc_QUERY_Deposit__Query_Deposit_10_1", "A");
memCache.Set("siafracc_QUERY_Deposit__0_1___CUSTOM", "B");
var keys = cache.GetKeysStartingWith("siafracc_QUERY_Deposit");
var memKeys = memCache.GetKeysStartingWith("siafracc_QUERY_Deposit");
cache.RemoveAll(keys);
memCache.RemoveAll(memKeys);
var newKeys = cache.GetKeysStartingWith("siafracc_QUERY_Deposit");
var memNewKeys = memCache.GetKeysStartingWith("siafracc_QUERY_Deposit");
"oldKeys:".Print();
keys.PrintDump();
"newKeys:".Print();
newKeys.PrintDump();
"memNewKeys:".Print();
memNewKeys.PrintDump();
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="System.Memory" version="4.5.4" targetFramework="net45" />
<package id="ServiceStack.Text" version="5.9.0" targetFramework="net45" />
<package id="ServiceStack.Client" version="5.9.0" targetFramework="net45" />
<package id="ServiceStack.Interfaces" version="5.9.0" targetFramework="net45" />
<package id="ServiceStack.Redis" version="5.9.0" targetFramework="net45" />
<package id="ServiceStack" version="5.9.0" targetFramework="net45" />
</packages>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment