Some refactoring on httpCache, fixes tests