Added some checks so that when setting a cache entry fails, we close connection (or we fail later when trying to use that empty entry). The small cache egfx capability has also been fixed.