Pregunta de entrevista de Amazon

design api for cache management

Respuestas de entrevistas

Anónimo

24 dic 2011

looking for what kind of function u will expose with exceptions etc...

Anónimo

3 ene 2012

What was the answer for this? My answer would be we should apply adapter design pattern (or bridge) into this question since we could cache data using many storage engine (file, memcache, db).

Anónimo

21 oct 2012

From answer is Cache with Proxy pattern package xyz; public interface Data{ public String getData(); } package xyz; class RealData implements Data{ private String data; RealData(String data){ this.data = data; } public String getData(){ return data; } } package xyz; public class CacheDataProxy implements Data{ private String data = null; private RealData realData; public CacheDataProxy(){ realData = new RealData(); } public String getData(){ if(data == null){ data = realData.getData(); } return data; } }