I have heard a lot of times about redis in the past but I had never had a deep look into it. This tutorial answered a lot of my questions and maybe will do the same for you to:
I've carefully read Redis's features, and while I find it interesting, I haven't yet found an application that could truly benefit from it
Probably, as long as we're talking about small databases (few hundred-thousand tables and a few million rows), the difference with traditional db servers isn't noticeable
Have any of you used it?
What exactly do you use it for?
I've carefully read Redis's features, and while I find it interesting, I haven't yet found an application that could truly benefit from it
Probably, as long as we're talking about small databases (few hundred-thousand tables and a few million rows), the difference with traditional db servers isn't noticeable
Have any of you used it?
What exactly do you use it for?
I have heard a single sentence that sums up the whole basic use of Redis. This sentence is: "The fastest query is the query that will not be executed". In a nutshell: "It is a caching layer for data in a basic approach and expanding it with modules, as you saw, can be used for all types of databases". This is also a benefit: Common data interface for different kind of DBs. Further more connecting each handler of a webapp directly with the database, for a very busy application, the maximum number of connections might quickly be exausted. With several instances of redis you increase dramatically the maximum amount of concurrent users that can "query" the same data.
Until you think your server is becoming slow, the memory becomes a bottleneck, you are running micro-services architecture for so called "modern" application stack, you need to scale or improve the performance of the server, I don't think you need it.
This is only from what I've been reading (no personal experience):
1) There seems to be a trend to move away from Redis unless it's really required. It looks like PostgreSQL can fill the role of both the DB and cache layer.
Until you think your server is becoming slow, the memory becomes a bottleneck, you are running micro-services architecture for so called "modern" application stack, you need to scale or improve the performance of the server, I don't think you need it.
I never wrote that my server is slowing down
And I never wrote about using a microservices-based system
Whether I need Redis or not is irrelevant
The question I asked was: for which system is Redis effective?
Hello everyone.
I'm currently testing this Redis client library. I have heard of Redis previously, but not really thought anything of it until I saw this thread.
To tell you the truth, just like @amorosik, I can't find any use for it for myself or for any of my clients. I don't see a good reason why I would personally use it, when I can just use KVS locally if need be in B4X solutions, and then clear KVS when I've finished using it.
Anyway, I’ve wrapped the client code and it’s now working perfectly in B4J. I thought I’d get some inspiration about using it, but it hasn’t inspired me at all.
I don’t like the idea of having an extra server running on my development laptop, so I’m going to disable the service until I continue testing this library. Let’s hope I remember to re‑enable the service next time.
Close Close everything: unsubscribe, close pool, shutdown executor.
DelAsync (key AsString) Async DEL
ExistsAsync (key AsString) Async EXISTS
Checks if a key exists in Redis. Returns a boolean.
ExpireAsync (key AsString, seconds AsLong) Async EXPIRE
Sets a timeout on a key in seconds.
GetAsync (key AsString) Async GET
GetRawPoolAsredis.clients.jedis.JedisPool Expose raw pool for advanced usage. Use with caution.
HDelAsync (key AsString, field AsString) Async HDel - Hash
HExistsAsync (key AsString, field AsString) Async HEXISTS - Hash
Checks if a specific hash field exists.
HGetAllAsync (key AsString) Async HGETALL - Hash
Retrieves all fields and values in a hash.
HGetAsync (key AsString, field AsString) Async HGET - Hash
HSetAsync (key AsString, field AsString, value AsString) Async HSET - Hash
Initialize (maxThreads AsInt) Initialize with default queue size (100).
InitializeEx (maxThreads AsInt, queueSize AsInt) Initialize with custom thread and queue sizes.
InitializePool (EventName AsString, host AsString, port AsInt, timeoutMs AsInt, password AsString, database AsInt, maxTotal AsInt, maxIdle AsInt) Initialises a Jedis Redis connection pool.
EventName: B4X event prefix used for callbacks (e.g., EventName + "_PoolInitialized").
Host: Redis server hostname or IP ("127.0.0.1" for local, cloud endpoint for hosted Redis).
Port: Redis TCP port (default 6379).
TimeoutMs: Socket timeout in milliseconds (typical 2000-5000).
Password: Redis authentication password; empty if not required.
Database: Logical Redis database index (0-15), default is 0.
MaxTotal: Maximum total connections allowed in the pool.
MaxIdle: Maximum idle connections kept ready for reuse.
Notes:
- Fires EventName + "_PoolInitialized" with success/failure.
- Failure indicates DNS, socket, or authentication issues.
- Call Redis.Close() on shutdown to release pool resources.
IsInitializedAsBoolean Returns true if the object has been initialized and not yet closed.
LPushAsync (key AsString, value AsString) Async LPUSH - List
Inserts a value at the head of a list.
LRangeAsync (key AsString, start AsLong, stop AsLong) Async LRANGE - List
Retrieves a range of elements from a list.
So see all the elements, set stop to -1.
RPushAsync (key AsString, value AsString) Async RPUSH - List
Inserts a value at the tail of a list.
SAddAsync (key AsString, member AsString) Async SADD - Set
Adds a unique member to a set.
SetAsync (key AsString, value AsString) Async SET
SetBlockingSubmit (blocking AsBoolean) Configure whether submissions should block when the queue is full (CallerRunsPolicy) or use the default rejection handler.
Must be called after Initialize/InitializeEx.
SetDebugMode (debug AsBoolean) Enable or disable debug mode. When enabled, error results include stack traces.
SetSubscriberJoinTimeout (timeoutMs AsLong) Set subscriber join timeout in milliseconds used when waiting for subscriber thread termination during Unsubscribe.
SMembersAsync (key AsString) Async SMEMBERS - Set
Returns all members of a set as a list.
Subscribe (channel AsString) Subscribe to a channel. Uses a dedicated subscriber thread and Jedis instance.
Unsubscribe Unsubscribe and attempt to deterministically stop the subscriber thread.
To run in memory you need to installed the following server locally or use an online server. Apparently, there are only a few real online Redis servers in the world that you can connect to externally over TCP.
I've tested this library using the Developer Edition (RC) server in the link below
A key / value persistent store. The data is serialized using B4XSerializator and is stored in an internal database. The database can be shared between B4A, B4i and B4J. Using KVS is similar to using a Map. You initialize it once and then you can put or get items with Put, Get or GetDefault...
www.b4x.com
Same to you, I wrapped Lettuce to test out Redis but found it has no advantage but adding complexity.
Hopefully this is a quick question. I'm trying to do some array processing and sorting and think it would be easier to do this within a database environment, but don't want to have to go back to the mySql server for this temporary stuff. I think an in memory SQLite connection would work just...
Caches can be critical for servers and other apps where you cannot store all data in memory and still need good performance. A simple and cross platform cache implementation is available in the B4XCollections library...
B4XCache is a new collection added in B4XCollections v1.10. It is key / value store collection, similar to Map. When the cache reaches the set maximum size, the least recent used items are removed (30% of the items). The item recency is updated when it is added to the cache and whenever it is...
www.b4x.com
There are so many alternative ways to use cache besides using Redis.
However, Redis may be help to improve the loading performance compared to uncached method but same do other alternatives I mentioned above could provide.
If you read the comments for the video on first post, I think you will agree that the video is very much an advertisement for Redis. It's very confusing.
Here I found a better greater tutorial. It shows the real use case of Redis, which is to generate JSON API responses.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.