https://github.com/opensourceame/shorty
A URL shortener API
https://github.com/opensourceame/shorty
Last synced: 3 months ago
JSON representation
A URL shortener API
- Host: GitHub
- URL: https://github.com/opensourceame/shorty
- Owner: opensourceame
- Created: 2016-11-03T18:15:25.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-03-16T05:25:56.000Z (about 3 years ago)
- Last Synced: 2023-03-22T10:43:15.662Z (about 3 years ago)
- Language: Ruby
- Size: 20.5 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Shorty - a URL shortening API
## Installation
#### Requirements
* Ruby 2.x
* Bundler
* Redis server for storage
#### To install
```
bundle install
unicorn / rackup / (other rack server)
```
## Storage
Data is stored to Redis on database 1 in production and database 15 in development / test environments.
The Redis DB is flushed upon initialisation of the development environment.
### Why Redis?
I'm making the assumption here that these short codes are to be used for cases like a short URL for a map location for a festival.
Redis is ideal for quick lookups on keys and incrementing counters.
With 5 elements per hash per code a Redis server will use approximately 100MB RAM for 1 million short codes,
thus a cheap server (€20/month) could store tens of millions of short codes.
Keys automatically expire after a year. (Changeable by editing ```Shorty::Code::EXPIRE_SECONDS```)
## Tests
Simply run ```rspec``` from the root directory of the project.