ConnectionMultiplexer.Connect() optionally accepts a TextWriter for logging.
Interesting challenge (!) because dates are sparse.
Here's a thought: if you can find a way to represent dates as numbers (minutes past the year 2000?), then you could try a Sorted Set. The set would be keyed on the user ID. The score would be the numeric date representation. The value would be the log entry.
Then you can use ZRANGEBYSCORE to get log entries within a date range. Also, it should be easy/efficient to "get the N most recent log entries".
Example: ZADD user:23432:activity 1363800946 data
I'm one of the authors of the Feedly package which was mentioned.
We built a solution for the 2nd largest online fashion community and open sourced our approach: https://github.com/tschellenbach/Feedly It's currently the largest open source library aimed at solving this problem. You can use both Redis and Cassandra as storage backends.
Our redis storage backend uses sorted sets for data storage. https://github.com/tschellenbach/Feedly/tree/master/feedly/storage/redis In addition we use pubsub capabilities for the realtime components.
The same team which built Feedly also offers a hosted API, which handles the complexity for you. Have a look at getstream.io There are client libraries for Python, PHP, Node and Ruby. (This is based on Cassandra and therefore substantially cheaper to operate than running your own system using Redis)
In addition have a look at this high scalability post were we explain some of the design decisions involved: http://highscalability.com/blog/2013/10/28/design-decisions-for-scaling-your-high-traffic-feeds.html
This tutorial will help you setup a system like Pinterest's feed using Redis. It's quite easy to get started with.
To learn more about feed design I highly recommend reading some of the articles which we based Feedly on:
- Yahoo Research Paper
- Twitter 2013 Redis based, with fallback
- Cassandra at Instagram
- Etsy feed scaling
- Facebook history
- Django project, with good naming conventions. (But database only)
- http://activitystrea.ms/specs/atom/1.0/ (actor, verb, object, target)
- Quora post on best practises
- Quora scaling a social network feed
- Redis ruby example
- FriendFeed approach
- Thoonk setup
- Twitter's Approach