The embodiment of the invention provides a self-adaptive
cache management method and
system. The method comprises the following steps: firstly, configuring basic
expiration time, an updating strategy and a hotspot flow threshold value by utilizing intelligent
annotation, and generating a caching strategy basic instance bound with a service method; then, flow indexes such as the query rate per second, the
cache hit rate, the data updating frequency and the
response delay are collected in real time by means of a dynamic flow sensing module, a fluctuation coefficient is determined through a
sliding time window algorithm, and flow changes are sensed in real time; when the fluctuation coefficient is greater than a preset threshold value, dynamically updating the cache strategy among
inert updating, active preloading and expired data permitting strategies according to a preset rule, and associating the current instance; and finally, on the basis of the current instance of the cache strategy, utilizing a distributed lock coordination mechanism to guarantee the
atomicity of cache updating operation. According to the process, the
database pressure caused by
premature failure of the cache in the peak period and the resource waste in the valley period are reduced through dynamic adjustment of the cache strategy and distributed coordination, so that the
resource utilization rate can be remarkably improved.