Tag: NoSQL
-
Tracking daily active users (DAU) with Redis
Daily active users, also known as DAU, is the number of unique users that have interacted with a website or application in a given day. We’re going to discuss how to track this metric, in a language agnostic fashion. The concepts discussed and Redis commands utilized can be implemented in…
-
How to set Redis max memory usage
Redis is one of my favorite data stores. The multitude of data types makes it flexible enough to serve as a simple caching layer (replacing Memcached) or as a full-blown RDBMS replacement if you’re willing to jump through a few hoops. Because Redis is an in-memory data store, it’s limited…
-
How to get the first and last item from an array in MongoDB
One of the great features of MongoDB is the ability to store an array in a document. While I’m fully aware that there are issues with storing unbounded arrays in MongoDB, due to document size limitations, there are times when you may want to store data in an array that…
-
Unique indexes with MongoDB and Mongoose
Even though I’ve been using MongoDB for the last few years, I’m still very much a noob when it comes to a lot of things. One of those things would be unique indexes. Generally speak, I interact with MongoDB three different ways: I write code that explicitly creates something with…
-
React Draft Wysiwyg with MongoDB
We love open source software here at CrowdSync. Sometimes though, we run into issues with the software we’ve deemed as the “right” package for us. A recent incident has been with React Draft Wysiwyg which we decided to use as part of our action to compose and send emails to…
-
Convert Mongo BSONDocument to an array in PHP
Ran into a scenario this weekend where I needed to take a sub-document from Mongo but I needed it in an array in PHP. Reading the data from Mongo with PHP was simple and won’t be discussed. What I’d like to talk about is taking the BSONDocument that Mongo returns…
-
Tracking peak users online with Redis
This probably isn’t the best way to track things, but it’s the best I came up with. Tracking the total number of users that log in per day or month is trivial as I have discussed in a previous post. To track the peak users online at a given time…
-
Bitmaps vs. Sets to track Monthly Active Users in Redis
Recently I was building a piece of functionality to track the daily and monthly active users on one of my sites. I already track this data in MySQL but retrieving the data was sluggish, even after creating a few new indexes, so I decided that I would use Redis. The…
-
How to pipeline with phpredis
Have you ever run into a scenario where you have to loop through a set of data and perform database queries for each iteration? Obviously we shouldn’t run them one by one, so we end up using a TRANSACTION or even just building out one large query in the case…
-
How to Install PHP Redis on Ubuntu 14.04 LTS
Previously, I had shown you how to install PHP Redis from source but things changed with the latest Ubuntu LTS release. Now you can install the phpredis extension from the Ubuntu respositories. First, if you don’t have it installed already, let’s install Redis: sudo apt-get install redis-server After we get…