A link shortener app written in Ruby on Rails.
Ruby 2.5.0
Rails 5.1.6
- This app uses Redis cache. So make sure you start Redis before running the app.
- Testing suite requires phantomjs to be installed. You can install it with
homebrew on mac:
brew install phantomjs
rails test
rails test:system
This app can handle 1k urls a day with each getting hit 20k times a day by adding the following caches:
- A cache that stores the shortened URL with the long URL. No need to hit the database after first visit.
- A cache that stores the usage counter. It will write back to db every 100 visits.
- A cache that stores the stat object. No need to hit the stat table for each visit.