[TIMOB-17884]: Add bounds check for cache

Testing steps in JIRA