May 11, 2023
-
3
Min Read

Easy mode: Drop Momento right into your Redis app

We're making it easy to pull the plug on Redis cluster management.
Chris Price
Headshot of the blog author
by
Chris Price
,
,
by
Chris Price
by
green squirrel logo for momento
Chris Price
,
,
Integration

Caching is hard. There are so many factors to consider! Do I need caching? What kind of cache should I use? How do I set up and operate the cache servers? What changes do I need to make to my code to take advantage of it?


At Momento, our brand is simplicity—from end to end. We are constantly working to come up with simple solutions that will take as many of those questions as possible off of your plate so you can focus on what matters to your business.


This starts with our Momento Cache service, where we handle all of the painful scaling and operations tasks for you. But it doesn’t end there; we build and own our client libraries in all of your favorite programming languages, and work tirelessly to make sure they are shockingly simple to use, and are tuned for ideal performance.


Drop-in solutions

But it doesn’t end there either! If you have an existing application that already uses caching features provided by another library or framework, you’re probably not eager to have to go change a bunch of code in order to switch to a different cache. So our goal is to meet you where you already live, and provide drop-in solutions that allow you to reap all of the benefits of Momento Serverless Cache with no changes to your application code.


Here are some cool integrations we’ve shared in the past that allow flipping on Momento with minimal app changes:


Today we have more to share!


Momento Redis compatibility clients

If you are already using a Redis client library in your application, great news! Now you have a growing list of drop-in replacements you can use to move your cache data to Momento—with no changes to your application code!


We’re building these libraries so all you have to change is an import statement and a constructor call. After that, you can turn off the lights on your existing cache cluster and let us worry about uptime and scaling so you won’t have to. And perhaps best of all, you will no longer need to pay for overprovisioned capacity in your cache infrastructure because Momento only bills you for the data you actually use.


As an example, here’s how to switch your code over if you’re using the node-redis library. If your current constructor call looks something like this:


const REDIS_HOST = 'my.redis-server.com';
const REDIS_PORT = 6379;
const REDIS_PASSWORD = 'mypasswd';

const redisClient = redis.createClient({
	url: 'redis://${REDIS_HOST}:${REDIS_PORT}',
	password: REDIS_PASSWORD
});


Then you just need to change it to look like this:


const redisClient = momentoRedis.createClient(
  new momento.CacheClient({
	configuration: momento.Configurations.Laptop.v1(),
	credentialProvider: momento.CredentialProvider.fromEnvironmentVariable({
  environmentVariableName: 'MOMENTO_AUTH_TOKEN',
	}),
	defaultTtlSeconds: 60,
  }),
  'cache_name'
);



And that’s it! Now your application’s cache data is stored in Momento and managing that cache cluster yourself will soon be a distant memory.


For working examples of all our drop-in replacements, check out our docs page! Do you use another framework that supports caching via @redis/client? If so, let us know about it! We’d love to add more examples to our repo and help you get it up and running with your favorite framework.


We’re just getting started!

We have more drop-in Momento integrations planned. Stay tuned for exciting announcements in the coming weeks!

If you have a favorite library or framework (in whatever programming language you are using!) that you would like to see a drop-in Momento integration with, please join our Discord or email us at support@momentohq.com.

We would love to hear about it. And we’re geeks for cool caching libraries so we will probably want to build it as well!

Chris Price
by
Chris Price
,
,
by
Chris Price
by
green squirrel logo for momento
by
Chris Price
,
,
Author
Chris Price

Chris is a software engineer who hails from Portland, OR. When not gardening or riding bikes, he enjoys analyzing and improving software performance and geeking out over metrics. He has technical leadership experience at companies of various shapes and sizes, from tiny startups to AWS. He is now passionately working to improve the productivity and happiness of all engineers who have ever experienced the joys of building and operating a cache cluster, by contributing to Momento’s serverless caching products.

Author
Author
Open