import { DatabaseDriver } from './database-driver' ; import { Log } from './../log' ; import { RedisDatabase } from './redis' ; import { LocalDatabase } from './local' ; /**
 * Class that controls the key/value data store.
 */ export class Database implements DatabaseDriver { type { DatabaseDriver } protected driver : DatabaseDriver ; param { any } options constructor ( protected options ) { if ( options . database . driver === 'redis' ) { this . driver = new RedisDatabase ( options ) ; } else if ( options . database . driver === 'local' ) { this . driver = new LocalDatabase ( options ) ; } else { Log . error ( 'Database driver not set.' ) ; } } param { string } key return { Promise < any > } get ( key ) { return this . driver . get ( key ) ; } param { string } key param { any } value return { void } set ( key , value ) { this . driver . set ( key , value ) ; } }