ServiceStack Redis client : remove all objects - redis

I want to remove all objects that are stored in Redis via the ServiceStack Redis client.
I tried to use the Remove method with "*" as a key but it is not ok.
Thanks.

If you want to clear all data on the Redis instance you can use:
redis.FlushAll();
Or if you just want to clear the DB you're on:
redis.FlushDb();

Related

is there a way to configure mTLS in Helidon MP without saving the certificates to the disk?

is there a way to configure mTLS in Helidon MP without saving the following to disk?
server.sockets.0.tls.trust.keystore-path
server.sockets.0.tls.private-key.keystore-path
client.tls.client.keystore-path
If we have these certificates as a Java object is there a way to pass those to the Helidon server?
I am using Helidon MP 2.3.1
I have tried configuring it with certificates on disk but I would like to avoid that.
From David Kral, there is no "easy" way to do this. Basically there are two possible options for you.
It is possible to create a new config with runtime created ConfigSource and instead of setting resource.resource-path one could use resource.content . The value here is Base64 encoded resource value. That means, you can store obtained certificate there.
Alternatively, you could create your own CDI extension. Inject ServerCdiExtension there and create initialization method (Similar to how ServerCdiExtension#startServer method looks like in terms of parameters). In this method you can obtain WebServer.Builder from injected ServerCdiExtension instance and it is possible to set Tls configuration the way you want it to be set. It is important to note, this extension has to have higher priority over theServerCdiExtension .

ASP.NET Core. Is there a built-in way to cache data per-service (isolate one service cache from another)?

I read a lot about caches in ASP.NET and it seems that there is no cache service I need, but may be you can help me find it.
My requirements:
The cache must be isolated per-component because I use the same key in different services to store different data.
It must support expiration settings like IMemoryCache does.
Why I need it? Because I have several services that request data from remote sources, and they all have to cache that data to show decent performance.
Maybe I don't get it and it's ok to use IMemoryCache, but I didn't find a way to isolate one service cache data from another service cache data. Of course, I can add a prefix to every key with the name of my service, but it's an ugly way to use it.

Apollo Server DataSource with Redis

I am interested in finding out if replacing the inMemoryCache provided by default by Apollo dataSource with a Redis cache - do I have to call my query my DB or do I have to load/unload my Redis client and then request data from it in the dataSource methods ? What about the cache keys? Does Apollo just create one for each used table of the database? As far as I have researched into this topic , it seems that the dataSource class takes care of everything - just pass the cache in the ApolloServer initialization , is it correct ? Thank you very much !
P.S. Is this functionality included in the generic DataSource?

Vertx 3.7.0+ Using the RedisAPI - Counterpart of mgetMany

In vertx prior to 3.7, there was a redis client method mgetmany:
RedisClient mgetMany(List<String> keys,
Handler<AsyncResult<JsonArray>> handler)
Get the values of all the given keys
In the native redis methods what is the counterpart of this?
How could we replace this method using the new RestAPI?
Its equivalent redis command is MGET.
refer redis doc here
You can use any redis client lib to call redis. (For example Jedis, Redision, Lettuce), which will provide you easy to use APIs

Redis as a self populating cache

Can Redis be used as a self populating cache (or pull-through cache) ?
In other words, is it able to create an entry on the fly if this entry is not cached yet ?
Redis is just a store: you add things to it and retrieve them back again. It has no awareness of what you are using it for (caching) or knowledge of the backend it would perform lookups from, that will depend on the application handling the request and using Redis to cache.
Can Redis be used as a self-populating cache (or pull-through cache)?
Yes! But Redis doesn't have an implementation for self-population.
So you just have to implement it yourself and it's easy too.
Define a wrapper class that extends(is-a relation) a redis client(of your choice).
Define Factory interfaces to create objects.
Override necessary methods that require pull-through implementation
3.1 If the key already exists, return it.
3.2 Otherwise use factory interfaces to create the value, cache it and return it.
Hope this answer is generic enough for any redis client.