Merging fix done for IDENTITY-2722

Fixing NPE when running cache cleanup task. Related JIRA: https://wso2.org/jira/browse/IDENTITY-2722