Content caching in the current commercial content delivery networks (CDNs) allows reduction of duplicate traffic and improvement of QoS and QoE but it still suffers from surges of content traffic, network congestion, high mobility of users and dynamic users' content request patterns which may result in high content access latency. With the increasing interest of large companies in providing next-generation mobile edge applications and services that the users can use despite potentially sparse, non-uniform connectivity, it is becoming increasingly important to provide efficient, smart content caching services at the edges to help with scalable storage and processing of local data as well as sharing data both at the edges and in the cloud. We propose a novel multi-agent deep reinforcement learning approach, CognitiveCache, in which edges adaptively learn their best caching policies while collaborating with other neighbouring edges to better understand if they can be usable for cache content placement optimisation problem in dynamic environments. We show that CognitiveCache can respond and adapt to the spatial-temporal locality of dynamically changing content workloads and resources, improve the reliability and scalability of content sharing, enhance QoE for users and decrease operational costs in mobile social community networks. We perform extensive multicriteria evaluation of our proposal against four benchmark and competitive protocols over two different realworld scenarios in New York and London in the face of different mobility and users' interest patterns to show that CognitiveCache achieves higher cache hit ratios, lower delays while reducing resource consumption. INDEX TERMS Mobile social community networks, edge cloud and fog networks, content caching, deep reinforcement learning, multilayer spatial-temporal locality