Caching based optimal resource allocation strategies in 5G networks and beyond