Redis Client Mac Os X

Introduction

Download Medis - GUI for Redis for macOS 10.10.0 or later and enjoy it on your Mac. ‎Medis is a beautiful, easy-to-use Redis GUI management application for Redis = 2.8. Medis starts with all the basic features you need:. Keys viewing/editing. SSH Tunnel for connecting with remote servers. Terminal for executing custom commands. Config viewing/editingIt also supports many ad. QuickRedis is a free foreverRedis Desktop manager. It supports direct connection, sentinel, and cluster mode, supports multiple languages, supports hundreds of millions of keys, and has an amazing UI. Operating System: Mac OS X 10.7+ 64-bit, Ubuntu 14.04+ 64-bit, or Windows 10 Software: Docker, or local installs of Python 3.8, make and Redis 5 or 6 Non-blocked access to youtube.com, university.redislabs.com and github.com. It put the same engine that powers Redis's redis-cli shell. Everything you can write in redis-cli shell — you can write in FastoRedis! Our program works on the most amount of Linux systems, also on Windows, Mac OS X, FreeBSD and Android platforms, on desktops and embedded devices.

In this article I will explain how you can:

  1. Install and Configure Memcached on Mac OS X
  2. Use Memcached in your Java Application

I won’t go in too much detail about the benefits of using a distributed cache in your applications, but let’s at least provide some use cases for applications that are running in the context of an enterprise portal, eXo Platform in my case - surprising isn’t? And I will show this in another post.

We have many reasons to use a cache (distributed or not), in the context of enterprise portal, let’s take a look to some of these reasons:

  • A portal is used to aggregate data in a single page. These data could come from different sources : Web Services, Database, ERP, ….. and accessing the data in real time could be costly. So it will be quite interesting to cache the result of the call when possible.
  • If the portal is used to aggregate many data from many sources, it is sometime necessary to jump into another application to continue some operation. A distributed and shared cache could be used to manage some context between different applications running in different processes (JVM or even technologies)These are two example where a shared cache could be interesting for your portal based applications, we can find many other reason.

Install Redis Mac Os

Note that the Portlet API (JSR-286) contains already a cache mechanism that cache the HTML fragment, and that eXo Platform also provide a low level cache, based on JBoss Cache.

Installation and Configuration

Installing Memcached from sources

You can find some information about Memcached installation on the Memcached Wiki. The following steps are the steps that I have used on my environment.

Redis Client Mac Os X

As far as I know, Memached is not available as package for Mac OS X. I am still on Snow Leopard (10.6.8), and I have installed XCode and all development tools. I have use the article “Installing memcached 1.4.1 on Mac OS X 10.6 Snow Leopard” from wincent.com. For simplicity reason I have duplicate the content and updated to the latest releases.

1- Create a working directory :

Redis Client Mac Os X

2- Install libevent that is mandatory for memcached

3- Install memcached

Go back to your install directory (memcachedbuild)

You are now ready to use memcached that is available at /usr/local/bin/memcached.

This allows you to avoid changing to the pre-installed memcached located in /usr/bin, if you want to replace it instead of having you own install, just run the configure command with the following parameter: ./configure --prefix=/usr

Starting and testing Memcached

Start the memcached server, using the following command line:

This command starts the memcached server as demon (-d parameter), on the TCP port 11211 (this is the default value). You can find more about the memcached command using man memcached.

It is possible to connect and test your server using a telnet connection. Once connected you can set and get object in the cache, take a look to the following paragraph.

The set command allows you to put a new value in the cache using the following syntax:

  • key : the key used to store the data in the cache
  • flags : a 32 bits unsigned integer that memcached stored with the data
  • expiration_time : expiration time in seconds, if you put 0 this means no delay
  • number_if_bytes : number of bytes in the data block
  • noreply : option to tell the server to not return any value
  • value : the value to store and associate to the key.

This is a short view of the documentation located in your source directory /memcachedbuild/memcached-1.4.10/doc/protocol.txt.

The get command allows you to access the value that is associated with the key.

You can check the version of memcahed you are running by calling the stats command in your telnet session.

Your memcached server is up and running, you can now start to use it inside your applications.

Simple Java Application with Memcached

The easiest way to use memcached from your Java applications is to use a client library. You can find many client libraries. In this example I am using spymemcached developped by the people from Couchbase.

1- Adding SpyMemcached to your Maven project

Add the repository to you pom.xml (or you setting.xml)

then the dependency to your pom.xml

Redis Client Mac Os X 10.13

2- Use SpyMemcache client in your application

The following code is a simple Java class that allows you to enter the key and the value and set it in the cache.

So when executing the application you will see something like :

You can also access the object from a Telnet session:

You can use any Java class in your application, the only thing to do is to make this class serializable.

This is it for the first post about memcached and Java, I am currently working on a small example integrating Web Services call, Portlets and memcached.

In this post we will see How To Install Redis On Mac OS X

To install Redis, run the following commands: