performance: check cache directory existence also before lock