Blog

Luis Majano

August 05, 2022

Spread the word


Share your thoughts

Connect, Code and Scale!

v2.0.0 released!

 

We are very excited to bring you another release for our Redis Lucee Extension. This is a major release spawning research of over 9 months. We have done great strides in this new extension to not only bring you the best scaling capabilities via Redis, but also now to introduce to the CFML world: Real-Time messaging with Redis Pub/Sub! Here is our full release notes in our brand new documentation book: What's New With 2.0.0!

Please note that if you have a license for a 1.x extension, you will need to upgrade your licenses to 2.x!

Overview

The Redis Lucee Extension allows you to natively connect to a Redis Server cluster and leverage it for distributed caching, session/client storage and distribution, cluster RAM file systems, and much more. It can allow your Lucee servers to scale and extend easily by leveraging Redis Server as the platform of choice for session/cluster managements, caching and virtual file-systems.

If you have ever asked yourself these questions, then our Lucee Extension can help you:

  • Want real-time messaging between any technology that can talk to Redis?
  • Want pub/sub features in your CFML code?
  • Want to use round-robin balancing instead of sticky sessions?
  • How do you deal with session/client information when you have more than 1 server in your cluster?
  • How can I scale my Lucee servers when I am running out of RAM?
  • Do you want your users to still be logged in even if a server in my cluster dies or is restarted?
  • Do you want to have a cluster-wide file system?
  • Are you using a container based deployment and need off heap peristence?
  • Do you want to be able to cache data in a distributed and elastic fashion?

 

We have been working with Redis Server for many years and it has been a true pleasure to not only build scalable farms with it, but also it is incredibly responsive when it comes down to key-value storage and caching transactions.


What's New With 2.0.0

Version 2 is a major rewrite of our Java Extension. You can find the release notes and the major areas of improvement here.

Major Updates

New Docs

We have documented every single feature of this functionality in our new Gitbook: https://redis-cache.ortusbooks.com/. This opens the door for more docs and more collaboration with our customers. Docs FTW!

Redis Logical Database Support

By default Redis supports the concept of logical databases. In our previous extension you could only connect to database 0, which is the default database. This meant that all cache connections had to connect to this database and add a prefix key per connection to avoid collisions.

Now, you can add which logical database to connect to and partition your installation by logical database rather than by prefix. Thus, providing great separation of concerns for your connections and applications. On your cache connection details for the Redis Cache, just select which database number to connect to. That's it!

Redis Cluster Support

We have added the capability to connect to not only standalone Redis instances via our Redis Cache connector, but we have now introduced the Redis Cluster Cache connector. This connector can connect to any Redis Cluster and give you all the great features our extension gives.

Redis Cluster Functions

We have also introduced several new functions for usage in a cluster cache:

FunctionDescription
RedisGetCluster( cacheName )Get access to the underlying Redis Cluster Java class so you can execute native cluster commands.
RedisGetClusterNodes( cacheName )Returns a struct of all the nodes and their appropriate Java classes representing their node connection pools.

Redis Pub/Sub

We have introduced the capability for your CFML code to now leverage Redis Publish and Subscribe constructs. This will allow your CFML code to have native messaging via Redis.

What is Pub/Sub?

Redis Pub/Sub implements the Publish/Subscribe messaging paradigm. This decoupling of publishers and subscribers can allow for greater scalability and a more dynamic network topology.

  1. Subscribers express interest in one or more channels (literal channels or pattern channels).
  2. Publishers send messages into channels.
  3. Redis will push these messages into different subscribers which have matched the channel's message.

Pub/Sub Functions

In order to leverage this pattern you will use the following two functions:

FunctionDescription
RedisPublish( channel, message, cacheName )Publish a message into Redis into a specific channel.
RedisSubscribe( subscriber, channels, cacheName )Subscribe to a channel for messages using a closure/lambda or a listener CFC

Publish Example

// Publish Example

Publishing messages...

RedisPublish( "test-channel", "Hola mi amigo" ); RedisPublish( "test-channel", "Hola mi amigo2" ); RedisPublish( "test-channel", "Hola mi amigo Redis" );

Finished publishing messages

Subscribe Example


// Subscribe with closure
closureSubscriber = redisSubscribe( ( channel, message ) => {
    writeDump( var="Message received on channel #arguments.channel#, #arguments.message#", output="console" );
}, "test-channel" );

// Subscribe with CFC
cfcSubscriber = redisSubscribe( new Subscriber(), "test-channel" );


Subscription started!! Check the logs!

Subscriber Listener CFC

component {

    public void function onMessage( String channel, String message ) {
        writeDump( var="Subscriber CFC -> onMessage called :#arguments.toString()#", output="console" );
    }

    public void function onPMessage( String pattern, String channel, String message ) {
        writeDump( var="Subscriber CFC -> onPMessage called :#arguments.toString()#", output="console" );
    }

    public void function onSubscribe( String channel, numeric subscribedChannels ) {
        writeDump( var="Subscriber CFC -> onSubscribe called :#arguments.toString()#", output="console" );
    }

    public void function onUnsubscribe( String channel, numeric subscribedChannels ) {
        writeDump( var="Subscriber CFC -> onUnsubscribe called :#arguments.toString()#", output="console" );
    }

    public void function onPUnsubscribe( String pattern, numeric subscribedChannels ) {
        writeDump( var="Subscriber CFC -> onPUnsubscribe called :#arguments.toString()#", output="console" );
    }

    public void function onPSubscribe( String pattern, numeric subscribedChannels ) {
        writeDump( var="Subscriber CFC -> onPSubscribe called :#arguments.toString()#", output="console" );
    }

}

Code Quality

We have completely refactored our internal Java code to include code quality metrics via SonarLint, upgrades to JDK 8-11 constructs, internal streams and so much more.

Better Exception Handling

Dealing with exceptions is always nasty. However, in this release we have optimized all exceptions so better debugging is added and we can pinpoint bugs and improvements.

Full Release Notes

Fixed

  • LRE-35 cache filters for getting entries was not working
  • LRE-32 getting all values/entries was not passing a built key, so return struct was always null
  • LRE-23 LicenseHelper not validating all editions of similar product skus

Added

  • LRE-41 Ability to choose which database to connect to in Redis, apart from 0 being the default
  • LRE-40 Migration of docs to gitbook
  • LRE-39 New redisSubscribe() so you can subscribe with closures/lambdas or CFCs to listen to Redis messages
  • LRE-38 New redisPublish() UDF so you can publish messages into the Redis cluster
  • LRE-37 New UDF redisGetClusterNodes() to get a map of cluster node objects
  • LRE-36 Redis Cluster protocol support (RedisCluster, Sentinel, AWS, DigitalOcean)
  • LRE-33 Redis publish and subscribe features
  • LRE-31 New native cfml function: redisGetCluster() to get access to the native redis cluster manager
  • LRE-30 Improve all exception handling to show exception messages
  • LRE-29 Creation of a base class to share between cache implementations
  • LRE-28 Add docker redis cluster support
  • LRE-27 Update Jedis to 2.9.3
  • LRE-25 Allow for a new setting to allow for case-sensitive mode instead of case-insensitive mode (default)

 

Purchase Extension


Resources

Please visit our Extension page for all the necessary resources.

Add Your Comment

Recent Entries

ColdBox 7.2.0 Released

ColdBox 7.2.0 Released

ColdBox, a widely used development platform for ColdFusion (CFML), has unveiled version 7.2. Packed with compelling new features, bug fixes, and enhancements, this release is designed to empower developers by boosting productivity, refining scheduled task capabilities, and enhancing the overall reliability and efficiency of application development. This article will delve into the key highlights of ColdBox 7.2 and elucidate how these advancements can positively impact developers in their daily coding endeavors.

Luis Majano
Luis Majano
November 20, 2023
Into the Box 2023 Series on CFCast

Into the Box 2023 Series on CFCast

Excitement is in the air as we unleash the highly anticipated ITB 2023 series exclusively for our valued CFCast subscribers – and the best part? It's FREE for CFCast members! Now is the perfect time if you haven't joined the CFCast community yet. Plus, we've got an incredible End-of-Year deal that's too good to miss

Maria Jose Herrera
Maria Jose Herrera
November 20, 2023
Ortus Deals are Finally Here!

Ortus Deals are Finally Here!

The much-anticipated Ortus End-of-the-Year Sale has arrived, and it's time to elevate your development experience! Whether you're a seasoned developer, a tech enthusiast, or someone on the lookout for top-notch projects, Ortus has something special in store for you. Brace yourself for incredible discounts across a wide array of products and services, including Ortus annual events, books, cutting-edge services, and more.

Maria Jose Herrera
Maria Jose Herrera
November 15, 2023