RedisDatabaseConnector

Content Type: Module
Categories: Utility,Connectors,Data

Overview

Easily integrate Redis into your Mendix applications.The RedisDatabaseConnector allows you to connect, read, write, and manage Redis key-value data structures seamlessly from your Mendix app. Ideal for high-performance caching, session storage, and fast data operations.

Documentation

โœ… Typical Usage Scenario

The Redis Database Connector module allows developers to seamlessly integrate Redis with their Mendix applications.

Customers can use this module to:

  • Store temporary data (sessions, user preferences, etc.)

  • Perform high-performance caching

  • Save and retrieve complex data structures (like JSON)

  • Queue operations using Redis Lists

  • Append logs or values to keys for logging or tracking use cases

This module is useful in:

  • Real-time applications (chat, dashboards)

  • Performance-optimized APIs

  • Scalable microservice architectures using Redis as a shared state

โœ… Features and Limitations

โœจ Features:

  • ๐Ÿ”น String Support: Append, Decrement, DeleteKey, Get, Increment, Set, SetWithExpity, Stringlength, Substring

  • ๐Ÿ”น List Support: AddListFromLeft, AddListFromRight, GetList, LeftPop, LeftPush, Range, RightPop, RightPush

  • ๐Ÿ”น JSON Support (via RedisJSON): JSONArrAppend, JSONArrInsert, JSONArrLength, JSONDeleteKeyOrObject, JSONGet, JSONMerge, JSONObjkeys, JSONSet

  • ๐Ÿ”น Set: SAdd, SAddList, SCountValues, SInterSection, SInterSectionStore, SIsMember, SMove, SRemove, SRemoveList, SUnion, SUnionStore

  • ๐Ÿ”น SortedSet: ZAdd, ZAddList, ZCountValues, ZRangeWithScores, ZRemove, ZRemoveList, ZReverseRangeWithScore

  • ๐Ÿ”น Efficient connection pooling using Jedis

  • ๐Ÿ”น Customizable Java Actions for flexibility

  • ๐Ÿ”น Built with Jackson for advanced JSON manipulation

โš ๏ธ Limitations (v1.0.0):

  • No support for Redis Hashย yet (coming in v2.0+)

  • Pub/Sub not included

  • No built-in TTL/expiration (planned)

  • Basic error handling โ€” custom retry strategies not implemented yet

โœ… Dependencies

Ensure the following JAR files are included in your project's userlib folder:

Library: - commons-pool22.12.1,

gson2.11.0,

jackson-annotations2.16.0,

jackson-core2.16.0,

jackson-databind2.16.0,

jedis6.0.0,

slf4j-api2.0.7,

slf4j-simple2.0.7

ย 

These are already bundled with the module for convenience.

โœ… Installation

  1. Download and import the RedisDatabaseConnector module into your Mendix project.

  2. Clean and build your project to refresh dependencies.

  3. (Optional) Create constant variables for RedisHost, Port, or Password if needed.

โœ… Configuration

  1. Open the Java actions and configure your Redis connection using:

    • Host (e.g., 127.0.0.1)

    • Port (default: 6379)

    • Password (if applicable)

  2. Use exposed Java actions such as:

    • Set for setting the String

    • Get from get the String

    • JsonSet

    • Leftpush

  3. Optionally use Export Mappings to serialize Mendix objects into JSON and store them in Redis.

โœ… Known Bugs

  • In rare cases, connection pool exhaustion can occur without retry if many parallel users interact with Redis.

โœ… Frequently Asked Questions

Q: Can I store full Mendix objects as JSON in Redis?

A: Yes! Use Export Mapping to convert the object to JSON and use JSONSet JavaAction.

Q: Will this work with Redis Cloud providers like Upstash or AWS ElastiCache?

A: Yes, as long as host/port and authentication are correctly configured.

Q: Can I retrieve Redis data and map it back to Mendix objects?

A: Yes. You can use Import Mappings with retrieved JSON to restore Mendix objects.

Q: How can I clear all keys?

A: This version does not include a flushAll method for safety reasons. You can extend the module if needed.

Releases

Version: 2.0.0
Framework Version: 10.0.0
Release Notes: ๐Ÿงพ RedisDatabaseConnector โ€“ Release Notes (v2.0.0) ๐Ÿš€ What's New ๐Ÿ”ข Sorted Set Enhancements โœ… ZRangeWithScores: Java action added to retrieve sorted set members with scores, ordered by ascending score. โœ… ZReverseRangeWithScores: New Java action to retrieve top N members from a sorted set in descending order of score, including score values. Supports pagination via start/stop indices. ๐Ÿ“š JSON Support Improvements ๐Ÿงฉ Added new JSON Java actions: JSONArrAppend: Append elements to a JSON array. JSONArrInsert: Insert elements at a specific index in a JSON array. JSONArrLength: Get length of a JSON array. JSONDeleteKeyOrObject: Delete a key or object from a JSON structure. JSONGet: Retrieve values using a JSONPath-like expression. JSONMerge: Merge two JSON objects. JSONObjKeys: Get keys from a JSON object. JSONSet: Set value at a specified path. ๐Ÿ› ๏ธ Improvements Improved error handling for sorted set operations. Better Mendix object mapping for ZSet members and scores. Enhanced support for BigDecimal score values to maintain precision. ๐Ÿงช Compatibility โœ… Compatible with Mendix 10+. ๐Ÿ” Requires Jedis 6.x or compatible Redis client library.
Version: 1.0.0
Framework Version: 10.0.0
Release Notes: ๐Ÿ“ฆ Redis Database Connector (v1.0.0) ๐Ÿ”ฅ Overview The Redis Database Connector module allows Mendix developers to connect to a Redis database and perform operations on: String List JSON (with RedisJSON module) This connector is optimized for dynamic use cases such as caching, session storage, state management, and more. โšก Supports modern Redis (v6+) with Jedis and Jackson libraries.