Questions tagged [redis]

Redis is an open-source, networked, in-memory, key-value data store.

Filter by
Sorted by
Tagged with
19
votes
2answers
1k views

API for looking up Japanese postal code

Most of my experience is in Python, Java and embedded C, and I need to learn Scala and Play for a new job. As an exercise, I decided to create a very simple API for looking up area by postal code, ...
11
votes
1answer
2k views

Redis rate limiting in Lua

I've implemented a rate limiter for redis in Lua, and I'm wondering if anyone has any suggestions that might improve the performance. An example use: ...
7
votes
2answers
507 views

Sum-based sliding rate limiting with Redis and Lua

As I'm new to Redis, I would like to get a review / improvement suggestions from Redis / Lua experts on the following problem and the solution I have found so far. Problem The context is: an e-...
7
votes
2answers
3k views

Redis Message Queue (Cloud)

I am in the process of writing a Cloud application (mostly hobby, learning) that required a very quick cache, queue, and messaging system. I have looked at a few different options from Microsoft (...
7
votes
1answer
184 views

Python Flask webserver with small features

With the latest of my projects, I started using Visual Studio Code, which allows for Python linting and also checking for poor practices, such as using over 100 characters in a single line. As you ...
6
votes
1answer
7k views

Async distributed locking with StackExchange.Redis [closed]

I have been trying to write an analogy to this approach to distributed locking with two differences: making it asynchronous making it work with StackExchange.Redis rather than AppFabric Cache. My ...
6
votes
1answer
69 views

Creating a server for user Internet orders

I've been learning the basics of node over the last couple of days and finally hooked up what I needed. I'm just after someone to comment on if I have gone the right way around this task. It creates ...
6
votes
1answer
234 views

Iterating over JSON docs

This Lua code runs in redis. It iterates over some JSON docs, and applies some logic based on the user (if any) making the request. I'm sure there's a lot I can improve here. ...
6
votes
1answer
279 views

Tornado chat with SockJS and Redis

I have Tornado chat with export to Redis. Other scripts will export messages from Redis to MongoDB in the time. It works, but how is it written? ...
5
votes
3answers
806 views

Chat logger using Redis

I'm developing a Java EE project which uses Redis through the Jedis library. I'm retrieving the chat history of a particular channel from the servlet context and if absent, from Redis. The PMD ...
5
votes
1answer
4k views

Store CSV in Redis

I needed to make a small script to read a csv file and store 2 columns in Redis. Can you guys take a look over the code and let me know how I can improve my code style? ...
5
votes
1answer
341 views

Server setup script for Redis, HAProxy and Node.js

I wrote a pretty basic setup script that handles most of the setup for a Three-server solution. The solution and setup file are available on GitHub The three servers are Redis, HAProxy and Node / ...
4
votes
1answer
87 views

Game boot to some operations every second

I am building game, like Ogame, or Ikariam where you can play with other users in real-time. You train some soldiers, and build some vehicles or buildings. Every building or vehicle has some level. If ...
4
votes
1answer
64 views

Fetching and storing new reddit posts

I've created a small tool that fetches and stores the newest self-posts from a specific subreddit. The posts are stored in a redis store. I'm going to write another couple of applications at a future ...
4
votes
1answer
58 views

GET event handler

I'm working on my first NodeJS / Express application with the async module. It's been an uphill battle for me learning node (and even JavaScript) as I go along so I'm sure there's a lot of room for ...
4
votes
0answers
344 views

2-tier c# cache

I have slightly altered Marc Gravells 2-tier cache code which can be seen here. I changed it to use Stackexchange.Redis instead of Booksleeve and also added some retry logic and serialization. ...
3
votes
1answer
7k views

Cached-object Store c# with Redis client for persistent storage

I have written a Cached-Object store with a Redis Client for persistent storage. The application that is going to use this is a heavy read application with the occasional write. I assume that entire ...
3
votes
1answer
6k views

Spring oauth2 token store supported by redis

I had to make a demo for Spring oauth2 with redis store for tokens. Started with the sparklr2 (with tonr2) sample app from here. They are demo apps to show oauth2 powered by spring. Sparklr is the ...
3
votes
3answers
104 views

Preventing floods while saving logs

I had a logging function… ...
3
votes
1answer
641 views

API to verify whether a Redis entry exists

I come from a PHP object oriented framework background (Laravel, Symfony, Silex...). With that, validation comes in pre-built classes mechanism in a framework that validates for you parameters that ...
3
votes
1answer
440 views

Model for web applications

I'm developing a model for web applications. The database that I use is Redis. I created special DbField objects like ...
3
votes
1answer
201 views

Redis lookup with a default value

I have some code to perform a redis lookup, but if the key to look up either doesn't exist or there's an issue connecting to Redis at all, it will use a default value. The logic currently looks like ...
3
votes
1answer
8k views

Redis Object storage and conversion

I am stepping into a new realm with this project, Reflection. I have written some working code (below) that will potentially store POCO objects in a redis cache (and eventually backed by Table or ...
3
votes
1answer
4k views

Redis Cache Data source code - Retrieve/Set/Invalidate actions

This is my RedisDataSource code. What I am mainly interested in is how the retry policy could be improved and if using WindowsAzure Trainsient Fault Handling this case (using Redis Azure Cache) makes ...
3
votes
1answer
443 views

Reducing lock contention for a caching utility, or make it totally lockless but threadsafe

My Java program is a module called configProxy which fetches configuration entries from a remote node (say from a Redis instance). When the caller calls the ...
3
votes
1answer
141 views

One minute cron Python script reads from MySQL and updates Redis based on calculations

The following code works and will be put into cron on a AWS server (not sure what specifications, cores, kernels etc) at a every 1 minute frequency. However, it's my first time putting a script into ...
3
votes
1answer
92 views

User-logging authentication

I'm little frustrated because I don't know how well I can refactor this script. I wrote the authentication function but it's too complicated, maybe too large in one function, and seems like spaghetti ...
3
votes
0answers
72 views

Token generating library on Redis

This is a token generating library for Go that runs on top of Redis. I'm using it as part of a larger projects. The library needs to be able to generate and validate tokens and return the associated ...
2
votes
2answers
4k views

Accessing a subset of keys from a nested dictionary in Python

I am trying to access data from Coinmarketcap API in Python and came up with the following code: ...
2
votes
1answer
575 views

Depersonalisation via redis cache

In an Azure Function, I have a c# program that processes tab delimited data into JSON entries. I'd like to improve it in terms of performance and the connection management. I want to remove personal ...
2
votes
1answer
2k views

Singleton method for Redis connection in Python

Here's my class for providing a singleton instance of a Redis connection. What do you think? ...
2
votes
1answer
58 views

Web scraper extracts zip files and publishes them to redis

I wrote this program for a job interview a while back. I would like general feedback on style, readability, maintainability, or any obvious flaws: ...
2
votes
2answers
273 views

Silly redis implementation

This is a silly Redis implementation that handles only three commands: INFO, ECHO, PING. The implementation is based on streams: ...
2
votes
1answer
607 views

NodeJS script to dump data from Redis to Elasticsearch

I have about a million records in Redis which I want to dump into Elasticsearch periodically. I just want to make sure that my script is decent enough in terms of speed and no memory leaks. ...
2
votes
1answer
457 views

LREM command for redis-like plugin

I had some difficulties implementing a redis-like plugin basil.js, particularly the LREM method. The complexity was to loop only once (and not the whole array every time if we have ...
2
votes
0answers
138 views

Redis lua - game leaderboard “overview”

Here is the code I invoke as Lua script in Redis. I use Redis sorted set to store game scores. This function is used to get some kind of overview of leaderboard. It returns id, score and rank of: ...
2
votes
1answer
288 views

Redis lock implementation

Considering I'm not implementing distributed lock mechanism, is this code correct and clear? ...
2
votes
0answers
1k views

Node.js and Redis based chat application

I have been worked on creating a chat tool similar to vk.com. Right now I have done a simple chat which requires only authentication via a PHP website and everyone can chat with each other. I used the ...
2
votes
0answers
364 views

RESTful API parsing DBF data HSET in Redis

I have this working code, but would like your review: sync.coffe ...
1
vote
1answer
587 views

GET and POST with Flask - optimum performance

I have this code to POST and save a digest to redis, and retrieve it from redis on a GET. This uses Python and Flask, of course. ...
1
vote
1answer
876 views

Spring Data Redis - mapping object relationships?

I'm designing an app that will process a set of social media messages which are posted by users. Each message is then scored and there is a reporting layer that will spit out a set of reports. The app ...
1
vote
1answer
729 views

Redis protocol implementation by Kotlin

I have created my first project on the github. It is Redis client protocol implementation (request-responce part only). I would like to make my sources more Kotlin style. Please, check my sources and ...
1
vote
2answers
329 views

Small C++ thread pool

I've made a small thread pool that i'll be using to communicate with a Redis server: ...
1
vote
1answer
237 views

Using Redis to store word occurences

I am doing a project where I am analyzing a group of Tweets. What I need to do is find the occurrence of each individual word. I am fairly new to Redis, so I am not quite sure that my solution is ...
1
vote
1answer
493 views

Write millions of lines to a file - Python, Dataframes and Redis [closed]

I have the following code snippet that reads a CSV into a dataframe, and writes out key-values pairs to a file in a Redis protocol-compliant fashion, i.e. ...
1
vote
1answer
159 views

Redis Client: Go based Game server

Here is my Go code to interact with a Redis server ...
1
vote
1answer
56 views

Store and output hard-coded relationships among hosts

The following code has begun to smell, but I have not yet decided with what to replace it, other than, obviously, a database. I made a very unsatisfactory workaround for my attempt to make ...
1
vote
0answers
44 views

Singleton pattern for Redis connection

Recently I have learned about singleton design pattern. I have tried to implement Redis connection following singleton design pattern. conn/redis.go ...
1
vote
0answers
111 views

Fetch key from MySQL DB if doesn't exist in redis DB

This code gets data from a MySQL database, such that if a key doesn't exist in a Redis database, then fetching of data needs to be done from the MySQL database and then stored in Redis cache. As such, ...
1
vote
0answers
749 views

JavaScript to connect to Redis using Singleton

I'm trying to create a class to connect to Redis in Express. I don't think my code is good enough as I got variable db hanging out. ...