GeneXus allows retrieving data from the in-memory cache to both web (1) and smart device applications (2); but what happens if the application runs in a distributed environment, or in the cloud?
In a distributed environment, the local cache of the application server is useless. In this case, you need a distributed memory object caching system to guarantee the validity of the cached information.
The solution in this scenario (mostly applications that run on the cloud or in a clustered environment) is to use a distributed cache.
For distributed environments, the GeneXus application can be configured at runtime to use Redis or Memcached for ResultSet caching in GeneXus and Smart Devices caching as well.
See Distributed Resultset caching in GeneXus and Smart Devices distributed Caching to understand the cache behavior.
First of all, configure caching in GeneXus. It's the same as configuring the server local cache (1)(2).
The way to configure distributed caching is through the Cache Provider property.
Note: The cache is an in-memory key-value store where the key-value pair depends on the application platform. For SD applications, the key corresponds to the database table, and the value is the table modification timestamp. For web and web services, the key corresponds to the query with its parameters and the value is the resultset of the query.
On the server, any implementation of Memcached or Redis has to be installed. For example, AWS ElastiCache.
In the client machine, the corresponding API implementation has to be referenced in the classpath for Java or included in the bin directory of the web application for Csharp.
First, check that the BeITMemcached client DLLs have been copied to the bin directory.
Additionally, download the Memcached for Windows server.
Configure the Cache Provider property, the Cache Location property, (and the Cache Username property and Cache Password property if necessary).
Download the Redis server and install it as a service on Windows.
The ServiceStack client is used in this case.
Configure the Cache Provider property, the Cache Location property, (and the Cache Username property and Cache Password property if necessary).
Licensing Notice: Refer to SAC 40283.
Download the spymemcached-2.10.3.jar - spy memcached jar file - and copy it to the lib directory under the web app.
You can do it programmatically. See Cache API.
For the time being, the feature is supported in these combinations:
- JAVA - Memcached - authentication supported
- .NET - Memcached - authentication not supported
- .NET - Redis - authentication supported
(1) Database access caching property
(2) Native Mobile caching
(3) Smart Devices distributed Caching
(4) Distributed Resultset caching in GeneXus
(5) Cache API