For per cell TTL, see https://issues.apache.org/jira/browse/HBASE-10560

Cheers

On Apr 13, 2014, at 11:06 PM, Li Li <fancye...@gmail.com> wrote:

> hi all
>   I want to use hbase as a global cache. I need some advice .
>   getFromCache(String key){
>       get from hbase;
>       if exist return result;
>       value="working...";
> 
>       boolean res=checkAndPut;
>       if(res){
>              value=doWork(key);
>              Put(key, value);
>        }else{ //some other thread is doing work now
>              //sleep a while and retry
>              for(int i=0;i<MAX_RETRY;i++){
>                    sleep;
>                    get value from hbase
>                    if(value!="working...") return value;
>              }
>              //some thing wrong happens such as working thread crash
>              //do it myself
>              value=doWork(key);
>              Put(key,value);
>              return value;
>        }
>     }
> 
>     btw, hbase has TTL for column family. is it possible to set ttl
> per row/cell?

Reply via email to