Ashwinstein / kitty-cache

Automatically exported from code.google.com/p/kitty-cache
0 stars 0 forks source link

remove does not decrement value if successfully removes #3

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Should not the   size.decrementAndGet() be before returning the entry

should not this...
public Object removeAndGet(KEYTYPE key){
        Object[] entry = cache.remove(key);
        if (entry != null) {

            return entry[1];
        }
        size.decrementAndGet();

        return null;
    }

be like this...

should this
public Object removeAndGet(KEYTYPE key){
        Object[] entry = cache.remove(key);
        if (entry != null) {
           size.decrementAndGet();  
            return entry[1];
        }

        return null;
    }

Original issue reported on code.google.com by federico...@gmail.com on 17 Feb 2011 at 4:45

GoogleCodeExporter commented 8 years ago

Original comment by innovati...@gmail.com on 19 Dec 2011 at 6:49