Implement advanced sources caching based on the c/s ctx refactoring