Code Monkey home page Code Monkey logo

redis's Introduction

redis

A ColdFusion wrapper for Jedis and JRediSearch

Motivation

DonorDrive leverages distributed caching extensively throughout our platform. Redis is a very popular engine for caching, and the RediSearch module makes that cache searchable through a verbose query syntax.

Getting Started

The redis package assumes that it will reside in a lib directory under the web root, or mapped in the consuming application. You must also use our lib.util package for this to work (https://github.com/DonorDrive/util). In order to leverage the IQueryable interface for cache searching, you must also grab our sql project (https://github.com/DonorDrive/sql).

The jedis jar that ships with ACF must be updated to version 3.1.0 (note: we don't leverage any of the native CF-Redis functionality, so backward compatibility has not been tested). To leverage RediSearch via the QueryableCache component, you must also have JRediSearch 1.3.0 or higher installed.

How do I use this?

Redis runs as a separate service for CF to connect to. This is controlled via the ConnectionPool component:

connectionPool = new lib.redis.ConnectionPool()
	.setHost("127.0.0.1:6379")
	.open();

For Redis Sentinel, you may construct your ConnectionPool as such:

connectionPool = new lib.redis.ConnectionPool()
	.setMaster("redis-cluster")
	.setSentinels([
		"127.0.0.1:6379",
		...
	])
	.open();

Once created, the ConnectionPool may be leveraged to instantiate Cache or QueryableCache:

cache = new lib.redis.Cache(connectionPool, "mycache");

cache.put("foo", "bar");

The preceeding would result in a key of mycache:foo with a value of bar being inserted into the connected Redis instance. The Cache client currently supports native CF types (serializing arrays and structs as JSON on put()).

For a more in-depth examples, please refer to the unit tests.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.