export abstract class CacheService { protected getItem < T > ( key ) { const data = localStorage . getItem ( key ) ; if ( data && data !== 'undefined' ) { return JSON . parse ( data ) ; } return null ; } protected setItem ( key , data ) { if ( typeof data === 'string' ) { localStorage . setItem ( key , data ) ; } localStorage . setItem ( key , JSON . stringify ( data ) ) ; } protected removeItem ( key ) { localStorage . removeItem ( key ) ; } protected clear ( ) { localStorage . clear ( ) ; } }