URL shortener with redis as backend. Will try to use Redisson, Spring data and Jedis as backend implementation for redis access
- Create new mapping between long and short url
- Prohibit shortening urls from this service
- Count visitors for short url, deal with concurrency issues
- Automatically expire (remove) short urls
- Count total number of created mapping urls
- Count total number of visitors for all urls
- For short urls store information about user agents
- Store most viewed short urls
- Create new mapping entity. Expire with 0 seconds means do not expire. Check that expire >= 0.
POST /create
{
"url" : "http://some_long_url",
"expire" : "seconds from now",
}
{
"shortUrl" : "http://localhost:8001/dfgfdger",
"deleteToken" : "token for removal"
}
- Redirect to original (long) url.
GET /{shortUrl}
Redirect to short url
- Get information about short url (visitors, expiration date, original url, etc)
GET /info/{shortUrl}
{
"originalUrl: "http://some_long_url",
"expire": "expiration date and time",
"visitors": "count of visitors",
"created" : "date and time when the short url was created",
"user_agents" : [
"Google Chrome",
"Safari"
]
}
- Delete information about mapping (the token for removal)
DELETE /url?token=token_for_removal
200 - OK 404 - no such token found 404 - URL is already expired
- Get dashboard information about the service
GET /summary
{
"visitors" : 555,
"urls" : 99
}
- url#short_url originalUrl - original "long" url expire - when to expire - null if never created - when it was created visitors - number of visitors - 0 by default
- url:user_agents#short_url The set of user agents used to access the given short url
- total_urls - increment when a new url is created
- unique_visitors - store unique visitors (by ip) for a url (based on hyperloglog)
- total_visitors - increment when someone visits a short url
- most_viewed_urls - sorted set with most viewed urls
- Count of views for short url per day/week/month - try to use redis time series