Official Content

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.

GeneXus implementation for distributed caching

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.

How to configure distributed caching in GeneXus

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.

Server and client configuration

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.

Examples

1. Using Csharp and Memcached

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).

2. Using Csharp and Redis

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.

3. Using Java and Memcached

Download the spymemcached-2.10.3.jar - spy memcached jar file - and copy it to the lib directory under the web app.

How to invalidate the distributed caching

You can do it programmatically. See Cache API.

NOTE:

For the time being, the feature is supported in these combinations:

  • JAVA - Memcached - authentication supported
  • .NET - Memcached - authentication not supported
  • .NET - Redis - authentication supported

See Also

(1) Database access caching property
(2) Native Mobile caching
(3) Smart Devices distributed Caching
(4) Distributed Resultset caching in GeneXus
(5) Cache API



Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant