Documentation ¶
Index ¶
Constants ¶
View Source
const CacheDuration = 6 * time.Hour
Variables ¶
View Source
var (
StoreService = &StorageService{}
)
Top level declarations
Functions ¶
This section is empty.
Types ¶
type MongoStorageService ¶
type MongoStorageService struct {
// contains filtered or unexported fields
}
Define the struct wrapper around raw Mongo client
func (*MongoStorageService) RetrieveInitialUrl ¶
func (ss *MongoStorageService) RetrieveInitialUrl(shortUrl string) string
func (*MongoStorageService) SaveUrlMapping ¶
func (ss *MongoStorageService) SaveUrlMapping(shortUrl string, originalUrl string)
type RedisStorageService ¶
type RedisStorageService struct {
// contains filtered or unexported fields
}
Define the struct wrapper around raw Redis client
func (*RedisStorageService) RetrieveInitialUrl ¶
func (ss *RedisStorageService) RetrieveInitialUrl(shortUrl string) string
func (*RedisStorageService) SaveUrlMapping ¶
func (ss *RedisStorageService) SaveUrlMapping(shortUrl string, originalUrl string)
type StorageService ¶
type StorageService struct {
Strategy StorageStrategy
}
StorageService struct now holds the storage strategy
func InitializeStore ¶
func InitializeStore(storageType string) *StorageService
type StorageStrategy ¶
Database interface
Click to show internal directories.
Click to hide internal directories.