added cache space detection