WO2020006859A1 - Image cache cleaning method and device, terminal device and medium - Google Patents

Image cache cleaning method and device, terminal device and medium Download PDF

Info

Publication number
WO2020006859A1
WO2020006859A1 PCT/CN2018/104968 CN2018104968W WO2020006859A1 WO 2020006859 A1 WO2020006859 A1 WO 2020006859A1 CN 2018104968 W CN2018104968 W CN 2018104968W WO 2020006859 A1 WO2020006859 A1 WO 2020006859A1
Authority
WO
WIPO (PCT)
Prior art keywords
picture
cache
priority
cached
duration
Prior art date
Application number
PCT/CN2018/104968
Other languages
French (fr)
Chinese (zh)
Inventor
赵远
易鸿宾
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Priority to CN201810736691.X priority Critical
Priority to CN201810736691.XA priority patent/CN109299041A/en
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2020006859A1 publication Critical patent/WO2020006859A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0891Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches using clearing, invalidating or resetting means
    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]

Abstract

Provided in the present application are an image cache cleaning method and device, a terminal device and medium, which are applicable to the technical field of data processing, and the method comprises: when the total amount of the image cache is larger than a preset memory threshold value, determining the priority of each cached image on the basis of the collection mark value, the unloaded duration and the total loaded duration corresponding to the currently unloaded and undisplayed cached image, respectively; replacing a cached image with the priority lower than a preset level by a replacement image, and storing the image link corresponding to the cached image in association with the replacement image; and if the total amount of the image cache is greater than the memory threshold after the replacement operation is finished, sequentially cleaning the cached images according to an order of priority from low to high until the total amount of the image cache is less than or equal to the memory threshold. The embodiment of the invention will not carry out indiscriminate over-cleaning on the cached images as in the prior art, which greatly improves the accuracy of cleaning the cached images, and avoids the occurrence of abnormal operation of a user.

Description

一种图片缓存清理方法、装置、终端设备及介质Method, device, terminal equipment and medium for cleaning picture cache
本申请要求于2018年07月06日提交中国专利局、申请号为、发明名称为“一种图片缓存清理方法及终端设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office on July 6, 2018, with the application number and the invention name "A Picture Cache Cleaning Method and Terminal Device", the entire contents of which are incorporated herein by reference. in.
技术领域Technical field
本申请属于数据处理技术领域,尤其涉及一种图片缓存清理方法、装置、终端设备及介质。The present application belongs to the technical field of data processing, and in particular, relates to a method, a device, a terminal device, and a medium for cleaning a picture cache.
背景技术Background technique
瀑布式布局实现图片加载浏览,是现在一种比较新颖的网页图片浏览方式,基于瀑布流布局,用户在浏览图片过程中无需进行翻页,而是通过不断下拉滚动条或滑动滚轮的方式,就可以实现对网页中图片的无限浏览。瀑布式布局的方式进行图片浏览,在给用户带来便利性的同时,由于用户浏览过的图片都会被缓存到终端设备的内存之中,而瀑布式布局中用户浏览图片的速度快数量大,因此会使得对终端设备的内存占用情况非常严重。The waterfall layout is used to load and browse pictures. It is a relatively new way to browse pictures on web pages. Based on the waterfall layout, users do not need to turn pages during image browsing. Instead, they can continuously pull down the scroll bar or slide the scroll wheel. Can realize unlimited browsing of pictures in web pages. The waterfall layout is used for image browsing. While bringing convenience to users, the images browsed by the user will be cached in the memory of the terminal device. In the waterfall layout, users can browse pictures quickly. Therefore, the memory usage of the terminal device is very serious.
现有技术中为了保证用户对图片的正常浏览等操作以及浏览器的正常运行,都是在接收到内存警告后直接将图片缓存清空,这样虽然能实现对图片缓存的清理,但对于一些用户所需操作的图片缓存也会一并清理,使得用户在对缓存的图片进行操作时,容易出现操作异常的情况。In the prior art, in order to ensure the normal browsing of pictures by the user and the normal operation of the browser, the picture cache is directly emptied after receiving a memory warning. This can clean up the picture cache, but for some users, The image cache to be operated will also be cleaned up together, which makes it easy for the user to operate abnormally when operating the cached image.
技术问题technical problem
有鉴于此,本申请实施例提供了一种图片缓存清理方法及终端设备,以解决现有技术中对图片缓存进行清理时,容易造成用户操作异常情况的问题。In view of this, embodiments of the present application provide a picture cache cleaning method and a terminal device, so as to solve the problem that an abnormal operation situation of a user is easily caused when the picture cache is cleaned in the prior art.
技术解决方案Technical solutions
本申请实施例的第一方面提供了一种图片缓存清理方法,包括:A first aspect of the embodiments of the present application provides a method for cleaning a picture cache, including:
当图片缓存总量大于预设的内存阈值时,基于当前未加载显示的缓存图片分别对应的收藏标记值、未加载时长以及总加载时长确定各所述缓存图片的优先级,所述收藏标记值用于标示所述缓存图片是否存在于收藏列表,所述未加载时长为所述缓存图片最近一次被终端设备加载显示时间距离当前时间的时长,所述总加载时长为所述缓存图片被所述终端设备历史加载显示的时长总和;When the total picture cache is greater than a preset memory threshold, the priority of each cached picture is determined based on the favorite tag value, the unloaded time, and the total loaded time corresponding to the currently unloaded and displayed cached picture, respectively. It is used to indicate whether the cached picture exists in the favorite list, the unloaded time is the time when the cached picture was most recently loaded by the terminal device and the display time is away from the current time, and the total loaded time is the cached picture being used by the Sum of the duration of the terminal device history loading display;
利用替换图片替换所述优先级低于预设级别的所述缓存图片,并将该缓存图片对应的图片链接与所述替换图片关联存储,所述替换图片根据该缓存图片对应的图片名确定;Using a replacement picture to replace the cache picture with a priority lower than a preset level, and storing a picture link corresponding to the cache picture with the replacement picture, and the replacement picture is determined according to a picture name corresponding to the cache picture;
若完成替换操作后所述图片缓存总量大于所述内存阈值,按照优先级从低到高的顺序依次对所述缓存图片进行清理,直至所述图片缓存总量小于或等于所述内存阈值。If the total picture cache is greater than the memory threshold after completing the replacement operation, the cache pictures are cleaned in order from the lowest to the highest priority until the total picture cache is less than or equal to the memory threshold.
本申请实施例的第二方面提供了一种图片缓存清理装置,包括:A second aspect of the embodiments of the present application provides a picture cache cleaning device, including:
优先级排序模块,用于当图片缓存总量大于预设的内存阈值时,基于当前未加载显示的缓存图片分别对应的收藏标记值、未加载时长以及总加载时长确定各所述缓存图片的优先级,所述收藏标记值用于标示所述缓存图片是否存在于收藏列表,所述未加载时长为所述缓存图片最近一次被终端设备加载显示时间距离当前时间的时长,所述总加载时长为所述缓存图片被所述终端设备历史加载显示的时长总和;The priority sorting module is configured to determine the priority of each cached picture based on the favorite tag value, the unloaded duration, and the total loaded duration of the currently unloaded displayed cached pictures when the total amount of the picture cache is greater than a preset memory threshold. Level, the favorite flag value is used to indicate whether the cached picture exists in the favorite list, the unloaded time is the time when the cached picture was last loaded by the terminal device and the display time is away from the current time, and the total loading time is A total length of time during which the cached picture is loaded and displayed by the terminal device history;
图片替换模块,用于利用替换图片替换所述优先级低于预设级别的所述缓存图片,并将该缓存图片对应的图片链接与所述替换图片关联存储,所述替换图片根据该缓存图片对应的图片名确定;A picture replacement module, configured to replace the cache picture with a priority lower than a preset level by using a replacement picture, and store a picture link corresponding to the cache picture with the replacement picture, and the replacement picture is based on the cache picture The corresponding picture name is determined;
多级清理模块,用于若完成替换操作后所述图片缓存总量大于所述内存阈值,按照优先级从低到高的顺序依次对所述缓存图片进行清理,直至所述图片缓存总量小于或等于所述内存阈值。A multi-level cleaning module is used to clean up the cached pictures in order from the lowest to the highest priority if the total amount of the picture cache is greater than the memory threshold after the replacement operation is completed, until the total amount of the picture cache is less than Or equal to the memory threshold.
本申请实施例的第三方面提供了一种终端设备,包括存储器、处理器,所述存储器上存储有可在所述处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现如下步骤:A third aspect of the embodiments of the present application provides a terminal device including a memory and a processor. The memory stores computer-readable instructions executable on the processor, and the processor executes the computer-readable instructions. The following steps are implemented when reading instructions:
当图片缓存总量大于预设的内存阈值时,基于当前未加载显示的缓存图片分别对应的收藏标记值、未加载时长以及总加载时长确定各所述缓存图片的优先级,所述收藏标记值用于标示所述缓存图片是否存在于收藏列表,所述未加载时长为所述缓存图片最近一次被终端设备加载显示时间距离当前时间的时长,所述总加载时长为所述缓存图片被所述终端设备历史加载显示的时长总和;When the total picture cache is greater than a preset memory threshold, the priority of each cached picture is determined based on the favorite tag value, the unloaded time, and the total loaded time corresponding to the currently unloaded and displayed cached picture, respectively. It is used to indicate whether the cached picture exists in the favorite list, the unloaded time is the time when the cached picture was most recently loaded by the terminal device and the display time is away from the current time, and the total loaded time is the cached picture being used by the Sum of the duration of the terminal device history loading display;
利用替换图片替换所述优先级低于预设级别的所述缓存图片,并将该缓存图片对应的图片链接与所述替换图片关联存储,所述替换图片根据该缓存图片对应的图片名确定;Using a replacement picture to replace the cache picture with a priority lower than a preset level, and storing a picture link corresponding to the cache picture with the replacement picture, and the replacement picture is determined according to a picture name corresponding to the cache picture;
若完成替换操作后所述图片缓存总量大于所述内存阈值,按照优先级从低到高的顺序依次对所述缓存图片进行清理,直至所述图片缓存总量小于或等于所述内存阈值。If the total picture cache is greater than the memory threshold after completing the replacement operation, the cache pictures are cleaned in order from the lowest to the highest priority until the total picture cache is less than or equal to the memory threshold.
本申请实施例的第四方面提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机可读指令,其特征在于,所述计算机可读指令被至少一个处理器执行时实现如下步骤:A fourth aspect of the embodiments of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores computer-readable instructions, and is characterized in that the computer-readable instructions are implemented when executed by at least one processor. The following steps:
当图片缓存总量大于预设的内存阈值时,基于当前未加载显示的缓存图片分别对应的收藏标记值、未加载时长以及总加载时长确定各所述缓存图片的优先级,所述收藏标记值用于标示所述缓存图片是否存在于收藏列表,所述未加载时长为所述缓存图片最近一次被终端设备加载显示时间距离当前时间的时长,所述总加载时长为所述缓存图片被所述终端设备历史加载显示的时长总和;When the total picture cache is greater than a preset memory threshold, the priority of each cached picture is determined based on the favorite tag value, the unloaded time, and the total loaded time corresponding to the currently unloaded and displayed cached picture, respectively. It is used to indicate whether the cached picture exists in the favorite list, the unloaded time is the time when the cached picture was most recently loaded by the terminal device and the display time is away from the current time, and the total loaded time is the cached picture being used by the Sum of the duration of the terminal device history loading display;
利用替换图片替换所述优先级低于预设级别的所述缓存图片,并将该缓存图片对应的图片链接与所述替换图片关联存储,所述替换图片根据该缓存图片对应的图片名确定;Using a replacement picture to replace the cache picture with a priority lower than a preset level, and storing a picture link corresponding to the cache picture with the replacement picture, and the replacement picture is determined according to a picture name corresponding to the cache picture;
若完成替换操作后所述图片缓存总量大于所述内存阈值,按照优先级从低到高的顺序依次对所述缓存图片进行清理,直至所述图片缓存总量小于或等于所述内存阈值。If the total picture cache is greater than the memory threshold after completing the replacement operation, the cache pictures are cleaned in order from the lowest to the highest priority until the total picture cache is less than or equal to the memory threshold.
有益效果Beneficial effect
在本申请实施例中,采用了多级清理策略对未加载显示的缓存图片进行清理,并在每次清理完成之后及时检测缓存图片占用内存是否过大,在占用内存没有达到内存阈值时及时停止对缓存图片的清理,从而实现了在对未加载显示的缓存图片及时有效的清理,且不会对用户当前浏览的缓存图片进行任何清理,保证了用户的正常操作。具体而言,首先根据用户对缓存图片的操作以及缓存图片的未加载时长和总加载时长来对当前未加载显示的缓存图片进行优先级排序处理,并对优先级最低的图片进行更小体积的图片替换,从而节约了对用户重要程度低的缓存图片的存储,同时又保证了瀑布式布局浏览图片时,不会出现图片空位不会使得图片产生位移,而通过图片信息+图片链接来对原缓存图片进行替换,使得用户若需对已清理的图片进行浏览等操作时,能够及时有效地获取到已清理图片的相关信息以及链接,从而保证了清理的同时用户能够正常进行图片相关操作。最后再根据优先级倒序对未加载的缓存图片进行层层清理,并在清理后及时判断是否达到清理目标,从而使得本申请实施例不会像现有技术一样对缓存图片进行无差别的过度清理,极大地提升了对缓存图片清理的精准度,避免了用户操作异常情况的发生。In the embodiment of the present application, a multi-level cleaning strategy is adopted to clean up the cached images that are not loaded and displayed, and after each cleanup is completed, it is timely detected whether the cached image takes up too much memory and stops in time when the occupied memory does not reach the memory threshold. The cleaning of the cached pictures is implemented to timely and effectively clean up the cached pictures that are not loaded and displayed, and does not clean up the cached pictures currently browsed by the user, ensuring the normal operation of the user. Specifically, first, according to the user ’s operation on the cached picture and the unloaded duration and total loading time of the cached picture, the currently unloaded displayed cached picture is prioritized, and the lowest-priority picture is subjected to a smaller size. Picture replacement, which saves the storage of cached pictures of low importance to users, and at the same time guarantees that when viewing pictures in waterfall layout, there will be no picture vacancies and no displacement of pictures. The cached picture is replaced, so that when the user needs to browse the cleaned picture and other operations, the related information and link of the cleaned picture can be obtained in a timely and effective manner, thereby ensuring that the user can normally perform picture related operations while cleaning. Finally, the unloaded cached images are cleaned layer by layer according to the priority order, and after cleaning, it is judged in time whether the cleaning target is reached, so that the embodiment of the present application does not perform indiscriminate over-cleaning of cached images as in the prior art. , Which greatly improves the accuracy of clearing cached images and avoids the occurrence of abnormal user operations.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings used in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only for the present application. For some embodiments, for those of ordinary skill in the art, other drawings may be obtained based on these drawings without paying creative labor.
图1是本申请实施例一提供的图片缓存清理方法的实现流程示意图;1 is a schematic flowchart of an image cache cleaning method provided in Embodiment 1 of the present application;
图2是本申请实施例二提供的图片缓存清理方法的实现流程示意图;2 is a schematic flowchart of an image cache cleaning method provided in Embodiment 2 of the present application;
图3是本申请实施例三提供的图片缓存清理方法的实现流程示意图;3 is a schematic flowchart of an image cache cleaning method provided in Embodiment 3 of the present application;
图4是本申请实施例四提供的图片缓存清理方法的实现流程示意图;4 is a schematic flowchart of an image cache cleaning method provided in Embodiment 4 of the present application;
图5是本申请实施例五提供的图片缓存清理装置的结构示意图;5 is a schematic structural diagram of a picture cache cleaning device provided in Embodiment 5 of the present application;
图6是本申请实施例六提供的终端设备的示意图。FIG. 6 is a schematic diagram of a terminal device provided in Embodiment 6 of the present application.
本发明的实施方式Embodiments of the invention
以下描述中,为了说明而不是为了限定,提出了诸如特定系统结构、技术之类的具体细节,以便透彻理解本申请实施例。然而,本领域的技术人员应当清楚,在没有这些具体细节的其它实施例中也可以实现本申请。在其它情况中,省略对众所周知的系统、装置、电路以及方法的详细说明,以免不必要的细节妨碍本申请的描述。In the following description, for the purpose of explanation rather than limitation, specific details such as a specific system structure and technology are provided in order to thoroughly understand the embodiments of the present application. However, it should be clear to a person skilled in the art that the present application can also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary details.
为了说明本申请所述的技术方案,下面通过具体实施例来进行说明。In order to explain the technical solution described in this application, the following description is made through specific embodiments.
图1示出了本申请实施例一提供的图片缓存清理方法的实现流程图,详述如下:FIG. 1 shows an implementation flowchart of a method for cleaning a picture cache provided in Embodiment 1 of the present application, which is detailed as follows:
S101,当图片缓存总量大于预设的内存阈值时,基于当前未加载显示的缓存图片分别对应的收藏标记值、未加载时长以及总加载时长确定各缓存图片的优先级,收藏标记值用于标示缓存图片是否存在于收藏列表,未加载时长为缓存图片最近一次被终端设备加载显示时间距离当前时间的时长,总加载时长为缓存图片被终端设备历史加载显示的时长总和。S101. When the total picture cache is larger than a preset memory threshold, the priority of each cached picture is determined based on the favorite tag value, the unloaded duration, and the total loaded duration of the currently unloaded and displayed cached picture respectively. The favorite tag value is used for Indicates whether the cached picture exists in the favorites list. The unloaded time is the time when the cached picture was last loaded by the terminal device. The total display time is the sum of the length of the cached picture displayed by the terminal device ’s history.
当缓存图片的占用内存过大时,开始对缓存图片进行清理,以保证用户对图片的正常浏览等操作。由于不同的缓存图片对用户的重要程度差异可能较大,如有些可能对用户非常重要,有些则可能对用户而言并没有什么作用,因此,若直接按照现有技术对所有缓存图片进行无差别清理,会导致对用户重要图片的一并误清理,从而使得用户正常操作容易受到影响。因此,为了实现对缓存图片的精准清理,以避免缓存图片清理对用户正常操作的影响,本申请实施例中会对每张缓存图片对用户的重要程度进行识别和优先级排序,再基于优先级顺序来进行后续的处理操作。When the memory occupied by the cached picture is too large, the cached picture is cleared to ensure that the user can browse the picture normally. Because the importance of different cached pictures to users may vary greatly, some may be very important to users, and some may not have much effect on users. Therefore, if all cached pictures are directly made according to the existing technology, there is no difference. Cleaning up will cause the user's important pictures to be mistakenly cleaned up together, thus making the normal operation of the user vulnerable. Therefore, in order to achieve accurate cleaning of cached images to avoid the impact of the cleaning of cached images on the normal operations of users, in the embodiment of the present application, the importance of each cached image to the user is identified and prioritized, and then based on the priority Perform subsequent processing operations sequentially.
其中,考虑到实际情况中当缓存图片对人们较为重要时,人们往往会在浏览缓存图片时进行收藏标记,同时人们对较为的喜欢缓存图片的浏览显示的时长以及频率等,也均明显高于其他缓存图片。因此,为了实现对缓存图片对用户重要程度的评估,本申请实施例中会综合缓存图片对应的收藏标记值、未加载时长以及总加载时长三方面因素,来对每张缓存图片对用户的重要程度进行识别和优先级排序及清理。其中具体的根据收藏标记值、未加载时长和总加载时长来进行优先度排序的具体方法此处不予限定,可由技术人员根据需求自行设定,包括但不限于如本申请实施例二的方法。Among them, considering that when cached pictures are more important to people, people tend to mark collections as they browse cached pictures. At the same time, the length and frequency of browsing and display of cached pictures that are more like are also significantly higher than Other cached pictures. Therefore, in order to evaluate the importance of the cached picture to the user, in the embodiment of the present application, the three factors of the bookmark value corresponding to the cached picture, the unloaded time and the total loaded time are combined to determine the importance of each cached picture to the user. Degree of identification and prioritization and cleanup. The specific method of prioritizing according to the bookmark value, the unloaded time, and the total loaded time is not limited here, and can be set by a technician according to requirements, including but not limited to the method as in the second embodiment of the present application. .
其中,内存阈值的具体值可由技术人员根据终端设备的实际内存情况,或者终端设备为应用程序分配的实际可使用内存情况来进行设置,但内存阈值应当小于或等于内存警告对应的内存阈值,以保证对缓存图片的有效清理。The specific value of the memory threshold can be set by a technician based on the actual memory of the terminal device or the actual available memory allocated by the terminal device for the application. However, the memory threshold should be less than or equal to the memory threshold corresponding to the memory warning. Effective cleaning of cached images is guaranteed.
S102,利用替换图片替换优先级低于预设级别的缓存图片,并将该缓存图片对应的图片链接与替换图片关联存储,替换图片根据该缓存图片对应的图片名确定。S102. Use a replacement picture to replace a cache picture with a priority lower than a preset level, and store a link to the picture corresponding to the cache picture with the replacement picture. The replacement picture is determined according to the picture name corresponding to the cache picture.
在确定出每张缓存图片对应的优先级顺序之后,开始对缓存图片进行清理。在本申请实施例中,首先会对优先级较低的一些缓存图片进行优先清理,由于优先级较低意味着这些缓存图片对用户而言较为不重要,用户再次操作使用这些缓存图片的概率也相对较小,因此优先对这些缓存图片进行清理,可以最大限度地减小对用户正常操作影响的可能性,防止用户操作异常情况的出现。其中预设级别对应的具体优先级级别,可由技术人员根据实际情况进行设定。After determining the priority order corresponding to each cached picture, cleaning up the cached picture is started. In the embodiment of the present application, some cached pictures with a lower priority are first cleaned first. Because the lower priority means that these cached pictures are less important to the user, the probability that the user operates the cached pictures again is also Relatively small, so cleaning these cached images first can minimize the possibility of affecting the normal operation of the user and prevent the occurrence of abnormal operation by the user. The specific priority level corresponding to the preset level can be set by a technician according to the actual situation.
其中,考虑到瀑布式布局中每张图片都是紧密相连排布的,在对其中的缓存图片进行清理时若直接删除缓存图片,会使得布局中出现图片位置空位,从而会使得布局中的图片产生位移,而位移又会导致用户在浏览图片时图片位置不断更变,进而使得用户无法正常进行图片浏览等操作。因此,为了保证缓存图片清理时用户对图片的正常浏览等操作,本申请实施例中采用了图片替换的方式,利用替换图片来对缓存图片进行替换,从而使得清理后的缓存图片对应位置仍有替换图片存在,不会出现图片空位和位移的情况。Among them, considering that each picture in the waterfall layout is closely connected, if the cached picture is directly deleted when the cached picture is cleaned up, it will make the picture position vacant in the layout, which will make the picture in the layout Displacement occurs, and the displacement will cause the user to constantly change the picture position when browsing the picture, which will prevent the user from performing normal operations such as picture browsing. Therefore, in order to ensure that the user can browse the pictures normally when the cached pictures are cleaned up, the embodiment of the present application uses a picture replacement method to replace the cached pictures with the replacement pictures, so that the corresponding positions of the cleaned up cached pictures still remain. The replacement picture exists, and there will be no vacancy and displacement of the picture.
本申请实施例在对缓存图片进行替换后,缓存图片原位置处会出现一张对应的替换图片,考虑到实际情况中用户极有可能会上下拉动滚动条或滚动滑轮以浏览图片,从而可能会浏览到替换图片,此时若替换图片不包含任何原缓存图片的相关信息,用户会无法正常获取到原缓存图片的任何信息,从而使得用户无法对原缓存图片进行任何操作。为了保证用户对替换图片的正常浏览等操作,本申请实施例在生成替换图片时,会记录其对应的原缓存图片的相关信息,如将原缓存图片的图片名或图片名中的关键字词记录显示至替换图片中,从而使得用户在看到替换图片时即可知道其对应的原缓存图片的图片名,同时还会将原缓存图片对应的本地图片或网络图片的图片链接与替换图片管理存储,从而用户不仅能知道替换图片对应的原缓存图片的相关信息,还能进一步地获取到其对应的图片文件,以满足用户进一步的对图片文件的操作需求,以保证在对缓存图片进行清理时用户对缓存图片的正常操作。In the embodiment of the present application, after the cached picture is replaced, a corresponding replacement picture will appear at the original position of the cached picture. Considering that the user is likely to pull up or down the scroll bar or the scroll wheel to browse the picture in the actual situation. Browse to the replacement picture. At this time, if the replacement picture does not contain any information about the original cached picture, the user will not be able to obtain any information about the original cached picture normally, so that the user cannot perform any operation on the original cached picture. In order to ensure the user's normal browsing and other operations on the replacement picture, when the replacement picture is generated, the related information of the original cached picture will be recorded, such as the picture name of the original cached picture or the keyword in the picture name. The record is displayed in the replacement picture, so that when the user sees the replacement picture, the user can know the picture name of the corresponding original cache picture, and at the same time, the picture link of the local cache or network picture corresponding to the original cache picture and the replacement picture management Storage, so that the user can not only know the relevant information of the original cached picture corresponding to the replacement picture, but also further obtain its corresponding picture file to meet the user's further operation requirements for the picture file to ensure that the cached picture is cleaned up The user's normal operation of the cached picture.
应当说明地,本申请实施例中虽然未对替换图片的具体生成方法进行限定,但由上述说明可知,由于替换图片在本申请实施例中同时具有着节省内存、提供原缓存图片相关信息以及保障用户图片浏览时不出现图片位移等作用,即本申请实施例中生成的替换图片至少应具有以下几个特征:1、替换图片占用内存相对原缓存图片占用内存更小,2、替换图片中包含原缓存图片的相关信息,3、使用替换图片替换后的瀑布式布局图片浏览中不会出现图片空位和位移的情况,因此,在对替换图片生成方法进行选取或设定时,需保证生成的替换图片至少能同时满足上述三个特征要求。It should be noted that although the specific generation method of the replacement picture is not limited in the embodiment of the present application, it can be known from the above description that the replacement picture also has the advantages of saving memory, providing information about the original cached picture, and guarantee in the embodiment of the present application. The user's picture does not appear to have effects such as picture displacement, that is, the replacement picture generated in the embodiment of the present application should have at least the following characteristics: 1. The replacement picture occupies less memory than the original cache picture, 2. The replacement picture contains Information about the original cached image. 3. There will be no picture gaps and displacements in the waterfall layout picture replacement after replacing with the replacement image. Therefore, when selecting or setting the replacement image generation method, you must ensure that the generated The replacement picture can at least meet the above three feature requirements at the same time.
作为本申请的一个实施例,优选地,为了保证替换图片同时满足上述三个特征要求,在对原缓存图片生成对应的替换图片时,本申请实施例中首先会读取原缓存图片的分辨率、在瀑布式布局中的缩略图尺寸以及对应的图片名或图片名中的关键字词,再生成尺寸与原缓存图片在瀑布式布局中的缩略图尺寸相同,但分辨率小于原缓存图片的分辨率的空白的替换图片,最后将原缓存图片的图片名或图片名中的关键字词填充至空白的替换图片之中,得到最终的原缓存图片生成对应的替换图片。由于实际应用中缩略图尺寸均小等于原缓存图片的原始尺寸,同时替换图片的分辨率更小,因此生成的替换图片的文件体积必定小于对应的原缓存图片,即占用内存更小,同时由于在瀑布式布局中预览展示时都是以缩略图进行布局展示的,因此保证了替换图片替换原缓存图片后,瀑布式布局图片浏览中每张替换图片占用的位置和大小都是与原缓存图片完全相同,因此不会出现图片空位和位移的情况。其中,初始图片的具体分辨率可由技术人员自行设定,如可以设定为一个较低的固定值,或者设置为原缓存图片分辨率的n%,n小于100等。As an embodiment of the present application, preferably, in order to ensure that the replacement picture simultaneously meets the above three characteristic requirements, when generating a corresponding replacement picture for the original cache picture, the embodiment of the present application first reads the resolution of the original cache picture , The thumbnail size in the waterfall layout and the corresponding picture name or keyword in the picture name, the regenerated size is the same as the thumbnail size of the original cached picture in the waterfall layout, but the resolution is smaller than the original cached picture The blank replacement picture with the resolution, and finally the picture name of the original cache picture or the keyword words in the picture name are filled into the blank replacement picture to obtain the final original cache picture and generate a corresponding replacement picture. Because the size of the thumbnails in the actual application is equal to the original size of the original cached picture and the resolution of the replacement picture is smaller, the file size of the generated replacement picture must be smaller than the corresponding original cached picture, that is, it takes up less memory. The preview display in the waterfall layout is displayed in thumbnails, so it is guaranteed that after the replacement image replaces the original cached image, the position and size occupied by each replacement image in the waterfall layout image browsing are the same as the original cached image. Exactly the same, so there will be no gaps or displacements in the picture. The specific resolution of the initial picture can be set by the technicians, for example, it can be set to a lower fixed value, or set to n% of the original cached picture resolution, n is less than 100, and so on.
S103,若完成替换操作后图片缓存总量大于内存阈值,按照优先级从低到高的顺序依次对缓存图片进行清理,直至图片缓存总量小于或等于内存阈值。S103. If the total picture cache is larger than the memory threshold after the replacement operation is completed, the cache pictures are cleaned up in order from the lowest to the highest priority until the total picture cache is less than or equal to the memory threshold.
若图片替换完成后缓存图片的占用内存仍过大,说明还需对缓存图片进行进一步的清理。由于优先等级越高缓存图片对用户的重要程度越高,在本申请实施例中,为了尽可能地减小缓存图片清理对用户正常操作的影响,会尽可能地先清理对用户较为不重要的缓存图片,并在每次对单个优先级的缓存图片清理完成后,检测缓存图片的占用内存是否满足内存阈值的要求,若满足则停止对缓存图片的清理,不满足则再继续对更高一级优先级的缓存图片的清理。If the memory occupied by the cached picture is still too large after the picture replacement is completed, it means that the cached picture needs further cleaning. Because the higher the priority level, the more important the cached picture is to the user. In the embodiment of the present application, in order to minimize the impact of the clearing of the cached picture on the normal operation of the user, the less important to the user will be cleared first. Cache pictures, and after each time a single priority cache picture is cleaned, check whether the occupied memory of the cache picture meets the requirements of the memory threshold. If it is satisfied, stop cleaning the cache picture. If it is not satisfied, continue to the higher one. High-priority cache image cleaning.
作为本申请的一个实施例,在S102之后,还包括:若完成替换操作后图片缓存总量不大于内存阈值,停止对缓存图片的清理。As an embodiment of the present application, after S102, the method further includes: if the total picture cache is not greater than the memory threshold after completing the replacement operation, stopping the cleaning of the cache picture.
为了尽可能地避免缓存图片清理对用户正常图片操作造成影响,在本申请实施例中仅对没有加载显示的缓存图片进行了清理,而对用户当前正在加载显示的缓存图片不进行清理操作。其中,采用了多级清理策略对未加载显示的缓存图片进行清理,并在每次清理完成之后及时检测缓存图片占用内存是否过大,在占用内存没有达到内存阈值时及时停止对缓存图片的清理,从而实现了在对未加载显示的缓存图片及时有效的清理,且不会对用户当前浏览的缓存图片进行任何清理,保证了用户的正常操作。具体而言,首先根据用户对缓存图片的操作以及缓存图片的未加载时长和总加载时长来对当前未加载显示的缓存图片进行优先级排序处理,并对优先级最低的图片进行更小体积的图片替换,从而节约了对用户重要程度低的缓存图片的存储,同时又保证了瀑布式布局浏览图片时,不会出现图片空位不会使得图片产生位移,而通过图片信息+图片链接来对原缓存图片进行替换,使得用户若需对已清理的图片进行浏览等操作时,能够及时有效地获取到已清理图片的相关信息以及链接,从而保证了清理的同时用户能够正常进行图片相关操作。最后再根据优先级倒序对未加载的缓存图片进行层层清理,并在清理后及时判断是否达到清理目标,从而使得本申请实施例不会像现有技术一样对缓存图片进行无差别的过度清理,极大地提升了对缓存图片清理的精准度,避免了用户操作异常情况的发生。In order to avoid as much as possible the impact of clearing the cached picture on the user's normal picture operations, in the embodiment of the present application, only the cached picture that is not loaded and displayed is cleaned up, and the cached picture that the user is currently loading and displaying is not cleaned up. Among them, a multi-level cleaning strategy is adopted to clean the cached images that are not loaded and displayed. After each cleaning is completed, it is timely detected whether the cached image takes up too much memory. When the occupied memory does not reach the memory threshold, the cached image is stopped in time. In this way, the cached pictures that are not loaded and displayed are timely and effectively cleaned up, and the cached pictures currently browsed by the user are not cleaned up in any way, which guarantees the normal operation of the user. Specifically, first, according to the user ’s operation on the cached picture and the unloaded duration and total loading time of the cached picture, the currently unloaded displayed cached picture is prioritized, and the lowest-priority picture is subjected to a smaller size. Picture replacement, which saves the storage of cached pictures of low importance to users, and at the same time guarantees that when viewing pictures in waterfall layout, there will be no picture vacancies and no displacement of pictures. The cached picture is replaced, so that when the user needs to browse the cleaned picture and other operations, the related information and link of the cleaned picture can be obtained in a timely and effective manner, thereby ensuring that the user can normally perform picture related operations while cleaning. Finally, the unloaded cached images are cleaned layer by layer according to the priority order, and after cleaning, it is judged in time whether the cleaning target is reached, so that the embodiment of the present application does not perform indiscriminate over-cleaning of cached images as in the prior art. , Which greatly improves the accuracy of clearing cached images and avoids the occurrence of abnormal user operations.
作为对缓存图片优先级排序的一种具体实现,如图2所示,本申请实施例二包括:As a specific implementation for prioritizing cached pictures, as shown in FIG. 2, the second embodiment of the present application includes:
S201,将存在于收藏列表的缓存图片设置为第一优先级,并判断不存在于收藏列表的缓存图片对应的未加载时长是否大于预设的第一时长阈值,以及对应的总加载时长是否大于预设的第二时长阈值。S201: Set the cached pictures existing in the favorite list as the first priority, and determine whether the corresponding unloaded duration corresponding to the cached pictures that do not exist in the favorite list is greater than a preset first duration threshold, and whether the corresponding total loaded duration is greater than The preset second duration threshold.
实际情况中,当用户对某张缓存图片收藏了时,说明该缓存图片对用户而言非常重要,因此,为了防止一开始就将这些非常重要的已收藏缓存图片清理掉,造成对重要缓存图片的误清理,本申请实施例中将其设定为最后处理的优先级最高的缓存图片。In actual situations, when a user bookmarks a cached picture, it means that the cached picture is very important to the user. Therefore, in order to prevent the very important cached pictures from being cleaned up at the beginning, causing the cached picture to be important The error clearing is set in the embodiment of the present application as the cache image with the highest priority in the final processing.
同时,对于未被收藏的缓存图片,本申请实施例按照未加载时长以及总加载时长来进行进一步的分类,以确定出对应的优先级。At the same time, for cached pictures that have not been collected, the embodiment of the present application further classifies the unloaded cached pictures according to the unloaded time and the total loaded time to determine the corresponding priority.
S202,将不存在于收藏列表,且对应的未加载时长不大于第一时长阈值的缓存图片设置为第二优先级。S202. Set the cache picture that does not exist in the favorite list and the corresponding unloaded duration is not greater than the first duration threshold to the second priority.
实际情况中,由于瀑布式布局的特殊性,用户极有可能会上下拉动滚动条或滚动滑轮以浏览图片,此时对于未加载时长较小(即脱离显示界面时间较短,离用户当前浏览操作的缓存图片位置较近)的缓存图片而言,其极有可能会被再次显示浏览,若这些图片被设置为优先被清理的行列,会导致用户图片浏览等操作时极为不便。因此为了尽可能地保证用户对缓存图片的正常浏览等操作,本申请实施例会将未加载时长较小的缓存图片设置为较为后面处理的第二优先级图片。In practice, due to the special nature of the waterfall layout, users are very likely to pull up or down the scroll bar or scroll wheel to browse the pictures. At this time, the time for unloading is small (that is, the time off the display interface is shorter, and the user ’s current browsing operation is shorter. For cached pictures, the cached pictures are more likely to be displayed and browsed again. If these pictures are set as the priority to be cleaned up, it will cause inconvenience when users browse pictures and other operations. Therefore, in order to ensure the user's normal browsing of the cached picture as much as possible, the embodiment of the present application sets the cached picture with a small unloaded time as the second priority picture to be processed later.
S203,将不存在于收藏列表,且对应的未加载时长大于第一时长阈值,对应的总加载时长大于第二时长阈值的缓存图片设置为第三优先级。S203. Set the cache picture that does not exist in the favorite list and has a corresponding unloaded duration that is longer than the first duration threshold and a corresponding total loaded duration that is longer than the second duration threshold as the third priority.
S204,将不存在于收藏列表,且对应的未加载时长大于第一时长阈值,对应的总加载时长不大于第二时长阈值的缓存图片设置为第四优先级。S204. Set the cache picture that does not exist in the favorite list and has a corresponding unloaded duration that is longer than the first duration threshold and a corresponding total loaded duration that is not longer than the second duration threshold as the fourth priority.
其中,第一优先级、第二优先级、第三优先级以及第四优先级的优先级级别依次降低。Among them, the priority levels of the first priority, the second priority, the third priority, and the fourth priority are decreased in order.
当未加载时长较长时,意味着缓存图片离用户当前浏览操作的缓存图片距离较远,因此对这些图片的清理,相对对用户正常操作的影响较小。其中,为了细化每一张缓存图片的优先级,以提高逐级清理的效果,本申请实施例还会对未加载时长较长的缓存图片进行进一步地优先级划分。对于总加载时长较长的缓存图片而言,用户对其浏览操作的时间更长,因此重要程度要高于总加载时长短的缓存图片,因此本申请实施例中会将总加载时长较长的缓存图片设置为优先级较高的第三优先级,而将总加载时长短的缓存图片设置为优先级较低的第四优先级,以保证对缓存图片的有效清理,保证用户的正常操作。When the unloading time is long, it means that the cached picture is far away from the cached picture of the user's current browsing operation. Therefore, the cleaning of these pictures has a relatively small impact on the normal operation of the user. In order to refine the priority of each cached picture to improve the effect of level-by-level cleaning, the embodiment of the present application further prioritizes cached pictures with a long unloaded duration. For cached pictures with a long total load time, users have a longer time to browse them. Therefore, they are more important than cached pictures with a long total load time. Therefore, in the embodiment of the present application, the The cached picture is set to a third priority with a higher priority, and the cached picture with a total load duration is set to a fourth priority with a lower priority to ensure effective cleaning of the cached pictures and normal operations of the user.
其中,本申请实施例中的阈值具体大小,可由技术人员根据实际情况自行设定。The specific size of the threshold in the embodiment of the present application can be set by a technician according to the actual situation.
作为对不同优先级缓存图片进行清理的一种具体实现,如图3所示,本申请实施例三包括:As a specific implementation for cleaning pictures with different priorities, as shown in FIG. 3, the third embodiment of the present application includes:
S1031,基于各优先级对应的图片压缩率,按照优先级从低到高的顺序依次对缓存图片进行压缩,直至图片缓存总量小于或等于内存阈值,其中,图片压缩率大小与优先级负相关。S1031. Based on the image compression rate corresponding to each priority, the cached pictures are compressed in order from the lowest to the highest priority until the total picture cache is less than or equal to the memory threshold, where the size of the picture compression rate is negatively related to the priority. .
虽然替换图片中虽然包含了原缓存图片的一些相关信息以及图片链接,可以一定程度上保证用户对原缓存图片的相关操作,但实际情况中,由于替换图片并未原缓存图片,因此在对替换图片进行浏览等操作时,还是对用户造成一定的影响。因此,为了在保证有效清理的同时保证用户的正常操作,本申请实施例在对低优先级的缓存图片替换完成后,会进一步地对剩余的缓存图片进行压缩处理,由于压缩的缓存图片只是分辨率降低了,对用户进行浏览等操作的影响较小,从而尽可能地保证了用户对缓存图片的正常操作。Although the replacement picture contains some related information of the original cached picture and the image link, which can guarantee the user's related operations on the original cached picture to a certain extent, in reality, because the replacement picture is not the original cached picture, When browsing pictures and other operations, it still affects users to some extent. Therefore, in order to ensure the effective cleaning and ensure the normal operation of the user, the embodiment of this application will further compress the remaining cached pictures after the replacement of the low-priority cached pictures. The rate is reduced, and the user's browsing and other operations have less impact, thereby ensuring the user's normal operation of the cached picture as much as possible.
其中,由于图片压缩率的大小,直接决定了本申请实施例可释放内存的大小,图片压缩率越大释放的内存也就越大,清理的效果也就越好,但另一方面来说,图片压缩率越大,对缓存图片的质量影响也就越大,从而对用户对缓存图片操作的影响也就越大,因此,为了实现更好的清理效果的同时,尽可能地减小对用户缓存图片正常操作的影响,本申请实施例中对每个优先级设置了不同的图片压缩率,且优先级越高,其对应的图片压缩率越低,以保证对重要缓存图片的影响减到最小,保证对用户缓存图片操作的影响减到最小。其中图片压缩率的具体值,可有技术人员根据实际需求进行设定。Among them, the size of the picture compression rate directly determines the size of the releasable memory in the embodiment of the present application. The larger the picture compression rate is, the larger the released memory is and the better the cleaning effect is, but on the other hand, The larger the picture compression ratio, the greater the impact on the quality of the cached picture, and therefore the greater the impact on the user's operation of the cached picture. Therefore, in order to achieve a better cleaning effect, at the same time, minimize the impact on the user The impact of the normal operation of cached pictures. In the embodiment of the present application, a different picture compression rate is set for each priority, and the higher the priority, the lower the corresponding picture compression rate to ensure that the impact on important cached pictures is reduced. Minimize the impact on the user's cached image operations to a minimum. The specific value of the picture compression ratio can be set by a technician according to actual needs.
作为本申请的实施例四,如图4所示,考虑到压缩不一定就能使得缓存图片占用内存下降到内存阈值的要求,因此,本申请实施例在压缩的基础上还会对缓存图片进行进一步地处理,以保证最终对缓存图片的有效清理,保证用户对图片的正常浏览等操作以及浏览器的正常运行,包括:As the fourth embodiment of the present application, as shown in FIG. 4, in consideration of the requirement that compression does not necessarily reduce the memory occupied by cached images to a memory threshold, the embodiment of the present application further performs a process on the cached images on the basis of compression. Further processing to ensure the effective cleaning of the cached picture, to ensure the normal operation of the user and the normal operation of the browser, including:
S1032,若压缩后的图片缓存总量大于内存阈值,按照优先级从低到高的顺序,依次对压缩后的缓存图片进行清理。S1032, if the total amount of compressed picture cache is greater than the memory threshold, the compressed cache picture is cleaned up in order from the lowest to the highest priority.
其中,具体对每张压缩后的缓存图片的清理方法此处不予限定,具体可由技术人员自行设定。The method for cleaning each compressed cache picture is not limited here, and can be specifically set by a technician.
作为对压缩后的缓存图片进行清理的一种具体实现,包括:As a specific implementation of cleaning up the compressed cache image, it includes:
利用替换图片替换当前优先级的压缩后的缓存图片,并将该缓存图片对应的图片链接与替换图片关联存储。Use the replacement picture to replace the compressed cache picture with the current priority, and store the image link corresponding to the cache picture with the replacement picture.
由于此处操作与S102操作相同,此处不予赘述。Since the operation here is the same as that of S102, it will not be repeated here.
在本申请实施例中,考虑到瀑布式布局的特殊性:用户对与当前浏览操作的图片距离较近(即未加载时长较短)的图片的查看概率极大,同时考虑到图片替换对用户正常操作的影响较大,因此对本申请实施例一中未替换的缓存图片进行处理时,优先进行了压缩处理,并对不同优先级的缓存图片设置了不同的图片压缩率以提升压缩时的清理效果,并在压缩不足以满足内存阈值的需求时,再对压缩后的图片进行进一步的图片替换,从而实现了对缓存图片的多级清理,以实现在对缓存图片进行精准有效清理的同时,最大化地保证用户对缓存图片的正常操作。In the embodiment of the present application, the particularity of the waterfall layout is taken into account: the user has a great probability of viewing an image that is closer to the current browsing operation (that is, the unloaded time is shorter), and considers that the replacement of the image to the user The impact of normal operation is great, so when processing the unreplaced cached pictures in the first embodiment of the present application, compression processing is preferentially performed, and different picture compression rates are set for cached pictures of different priorities to improve cleanup during compression. Effect, and when the compression is insufficient to meet the memory threshold requirements, further compressed image replacement is performed to achieve multi-level cleaning of cached images to achieve accurate and effective cleaning of cached images. Maximize the user's normal operation of cached pictures.
对应于上文实施例的方法,图5示出了本申请实施例提供的图片缓存清理装置的结构框图,为了便于说明,仅示出了与本申请实施例相关的部分。图5示例的图片缓存清理装置可以是前述实施例一提供的图片缓存清理方法的执行主体。Corresponding to the method of the above embodiment, FIG. 5 shows a structural block diagram of a picture cache cleaning device provided by an embodiment of the present application. For convenience of explanation, only parts related to the embodiment of the present application are shown. The image cache cleaning device illustrated in FIG. 5 may be an execution subject of the image cache cleaning method provided in the foregoing first embodiment.
参照图5,该图片缓存清理装置包括:Referring to FIG. 5, the picture cache cleaning device includes:
优先级排序模块51,用于当图片缓存总量大于预设的内存阈值时,基于当前未加载显示的缓存图片分别对应的收藏标记值、未加载时长以及总加载时长确定各所述缓存图片的优先级,所述收藏标记值用于标示所述缓存图片是否存在于收藏列表,所述未加载时长为所述缓存图片最近一次被终端设备加载显示时间距离当前时间的时长,所述总加载时长为所述缓存图片被所述终端设备历史加载显示的时长总和。The priority sorting module 51 is configured to determine the cache image based on the favorite tag value, the unloaded duration, and the total loaded duration of the currently unloaded displayed cached pictures when the total amount of the picture cache is greater than a preset memory threshold. Priority, the favorite flag value is used to indicate whether the cached picture exists in the favorite list, the unloaded time is the time when the cached picture was last loaded by the terminal device, and the display time is away from the current time, and the total loading time The total length of time for which the cached picture is loaded and displayed by the terminal device history.
图片替换模块52,用于利用替换图片替换所述优先级低于预设级别的所述缓存图片,并将该缓存图片对应的图片链接与所述替换图片关联存储,所述替换图片根据该缓存图片对应的图片名确定。A picture replacement module 52, configured to replace the cache picture with a priority lower than a preset level by using a replacement picture, and store a picture link corresponding to the cache picture with the replacement picture, and the replacement picture is based on the cache The picture name corresponding to the picture is determined.
多级清理模块53,用于若完成替换操作后所述图片缓存总量大于所述内存阈值,按照优先级从低到高的顺序依次对所述缓存图片进行清理,直至所述图片缓存总量小于或等于所述内存阈值。A multi-level cleaning module 53 is configured to clean up the cached pictures in order from low to high priority if the total amount of the picture cache is greater than the memory threshold after completing the replacement operation, until the total amount of the picture cache Is less than or equal to the memory threshold.
进一步地,优先级排序模块51,包括:Further, the priority ranking module 51 includes:
将存在于所述收藏列表的所述缓存图片设置为第一优先级,并判断不存在于所述收藏列表的所述缓存图片对应的所述未加载时长是否大于预设的第一时长阈值,以及对应的所述总加载时长是否大于预设的第二时长阈值。Setting the cached picture existing in the favorite list as a first priority, and judging whether the unloaded duration corresponding to the cached picture not existing in the favorite list is greater than a preset first duration threshold, And whether the corresponding total loading duration is greater than a preset second duration threshold.
将不存在于所述收藏列表,且对应的所述未加载时长不大于所述第一时长阈值的所述缓存图片设置为第二优先级。Setting the cache picture that does not exist in the favorite list and the corresponding unloaded duration is not greater than the first duration threshold as a second priority.
将不存在于所述收藏列表,且对应的所述未加载时长大于所述第一时长阈值,对应的所述总加载时长大于所述第二时长阈值的所述缓存图片设置为第三优先级。Setting the cache picture that does not exist in the favorite list and whose corresponding unloaded duration is greater than the first duration threshold and the corresponding total loaded duration is greater than the second duration threshold to a third priority .
将不存在于所述收藏列表,且对应的所述未加载时长大于所述第一时长阈值,对应的所述总加载时长不大于所述第二时长阈值的所述缓存图片设置为第四优先级。Setting the cache picture that does not exist in the favorite list and whose corresponding unloaded duration is greater than the first duration threshold and the corresponding total loaded duration is not greater than the second duration threshold as a fourth priority level.
其中,所述第一优先级、所述第二优先级、所述第三优先级以及所述第四优先级的优先级级别依次降低。The priority levels of the first priority, the second priority, the third priority, and the fourth priority are sequentially decreased.
进一步地,多级清理模块53,包括:Further, the multi-stage cleaning module 53 includes:
压缩模块,用于基于各优先级对应的图片压缩率,按照优先级从低到高的顺序依次对所述缓存图片进行压缩,直至所述图片缓存总量小于或等于所述内存阈值,其中,所述图片压缩率大小与优先级负相关。A compression module, configured to compress the cached pictures in order from the lowest to the highest priority based on the picture compression rate corresponding to each priority until the total amount of picture cache is less than or equal to the memory threshold, The picture compression ratio is inversely related to the priority.
进一步地,多级清理模块53,包括:Further, the multi-stage cleaning module 53 includes:
二次清理模块,用于若压缩后的所述图片缓存总量大于所述内存阈值,按照优先级从低到高的顺序,依次对压缩后的所述缓存图片进行清理。A secondary cleaning module is configured to clean up the compressed cached pictures in order from the lowest to the highest priority if the total amount of the compressed picture cache is greater than the memory threshold.
进一步地,二次清理模块,包括:Further, the secondary cleaning module includes:
利用所述替换图片替换当前优先级的压缩后的所述缓存图片,并将该缓存图片对应的图片链接与所述替换图片关联存储。Using the replacement picture to replace the compressed cache picture at the current priority, and storing a picture link corresponding to the cache picture in association with the replacement picture.
本申请实施例提供的图片缓存清理装置中各模块实现各自功能的过程,具体可参考前述图1所示实施例一的描述,此处不再赘述。For a process in which each module in the picture cache cleaning device provided by the embodiment of the present application implements its functions, reference may be made to the description of Embodiment 1 shown in FIG. 1 above, and details are not described herein again.
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。It should be understood that the size of the sequence numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
还应理解的是,虽然术语“第一”、“第二”等在文本中在一些本申请实施例中用来描述各种元素,但是这些元素不应该受到这些术语的限制。这些术语只是用来将一个元素与另一元素区分开。例如,第一接触可以被命名为第二接触,并且类似地,第二接触可以被命名为第一接触,而不背离各种所描述的实施例的范围。第一接触和第二接触都是接触,但是它们不是同一接触。It should also be understood that although the terms "first", "second", etc. are used in the text to describe various elements in some embodiments of the present application, these elements should not be limited by these terms. These terms are only used to distinguish one element from another. For example, a first contact may be named a second contact, and similarly, a second contact may be named a first contact without departing from the scope of the various described embodiments. Both the first contact and the second contact are contacts, but they are not the same contact.
图6是本申请一实施例提供的终端设备的示意图。如图6所示,该实施例的终端设备6包括:处理器60、存储器61,所述存储器61中存储有可在所述处理器60上运行的计算机可读指令62。所述处理器60执行所述计算机可读指令62时实现上述各个图片缓存清理方法实施例中的步骤,例如图1所示的步骤101至103。或者,所述处理器60执行所述计算机可读指令62时实现上述各装置实施例中各模块/单元的功能,例如图5所示模块51至53的功能。FIG. 6 is a schematic diagram of a terminal device according to an embodiment of the present application. As shown in FIG. 6, the terminal device 6 of this embodiment includes a processor 60 and a memory 61, and the memory 61 stores computer-readable instructions 62 that can be run on the processor 60. When the processor 60 executes the computer-readable instructions 62, steps in the embodiments of the foregoing picture cache cleaning method embodiments are implemented, for example, steps 101 to 103 shown in FIG. Alternatively, when the processor 60 executes the computer-readable instructions 62, the functions of each module / unit in the foregoing device embodiments are implemented, for example, the functions of modules 51 to 53 shown in FIG. 5.
所述终端设备6可以是桌上型计算机、笔记本、掌上电脑及云端服务器等计算设备。所述终端设备可包括,但不仅限于,处理器60、存储器61。本领域技术人员可以理解,图6仅仅是终端设备6的示例,并不构成对终端设备6的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如所述终端设备还可以包括输入发送设备、网络接入设备、总线等。The terminal device 6 may be a computing device such as a desktop computer, a notebook, a palmtop computer, and a cloud server. The terminal device may include, but is not limited to, a processor 60 and a memory 61. Those skilled in the art can understand that FIG. 6 is only an example of the terminal device 6, and does not constitute a limitation on the terminal device 6, and may include more or less components than shown in the figure, or combine some components or different components. For example, the terminal device may further include an input sending device, a network access device, a bus, and the like.
所称处理器60可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。The processor 60 may be a central processing unit (Central Processing Unit (CPU), or other general-purpose processors, Digital Signal Processors (DSPs), and application-specific integrated circuits (Applications) Specific Integrated Circuit (ASIC), off-the-shelf Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
所述存储器61可以是所述终端设备6的内部存储单元,例如终端设备6的硬盘或内存。所述存储器61也可以是所述终端设备6的外部存储设备,例如所述终端设备6上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,所述存储器61还可以既包括所述终端设备6的内部存储单元也包括外部存储设备。所述存储器61用于存储所述计算机可读指令以及所述终端设备所需的其他程序和数据。所述存储器61还可以用于暂时地存储已经发送或者将要发送的数据。The memory 61 may be an internal storage unit of the terminal device 6, such as a hard disk or a memory of the terminal device 6. The memory 61 may also be an external storage device of the terminal device 6, such as a plug-in hard disk, a smart media card (SMC), and a secure digital (SD) provided on the terminal device 6. Card, flash card, etc. Further, the memory 61 may further include both an internal storage unit of the terminal device 6 and an external storage device. The memory 61 is configured to store the computer-readable instructions and other programs and data required by the terminal device. The memory 61 may also be used to temporarily store data that has been sent or will be sent.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each of the units may exist separately physically, or two or more units may be integrated into one unit. The above integrated unit may be implemented in the form of hardware or in the form of software functional unit.
所述集成的模块/单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实现上述实施例方法中的全部或部分流程,也可以通过计算机可读指令来指令相关的硬件来完成,所述的计算机可读指令可存储于一计算机可读存储介质中,该计算机可读指令在被处理器执行时,可实现上述各个方法实施例的步骤。其中,所述计算机可读指令包括计算机可读指令代码,所述计算机可读指令代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质可以包括:能够携带所述计算机可读指令代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、电载波信号、电信信号以及软件分发介质等。需要说明的是,所述计算机可读介质包含的内容可以根据司法管辖区内立法和专利实践的要求进行适当的增减,例如在某些司法管辖区,根据立法和专利实践,计算机可读介质不包括电载波信号和电信信号。When the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the methods of the above embodiments, and can also be completed by computer-readable instructions instructing related hardware. The computer-readable instructions can be stored in a computer-readable storage medium In the computer-readable instructions, when executed by a processor, the steps of the foregoing method embodiments can be implemented. The computer-readable instructions include computer-readable instruction codes, and the computer-readable instruction codes may be in a source code form, an object code form, an executable file, or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer-readable instruction code, a recording medium, a U disk, a mobile hard disk, a magnetic disk, an optical disk, a computer memory, a read-only memory, ROM), Random Access Memory Memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdictions. For example, in some jurisdictions, the computer-readable medium Excludes electric carrier signals and telecommunication signals.
以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使对应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。The above-mentioned embodiments are only used to describe the technical solution of the present application, but not limited thereto. Although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still implement the foregoing implementations. The technical solutions described in the examples are modified, or some of the technical features are equivalently replaced; and these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in Within the scope of this application.

Claims (20)

  1. 一种图片缓存清理方法,其特征在于,包括:A picture cache cleaning method is characterized in that it includes:
    当图片缓存总量大于预设的内存阈值时,基于当前未加载显示的缓存图片分别对应的收藏标记值、未加载时长以及总加载时长确定各所述缓存图片的优先级,所述收藏标记值用于标示所述缓存图片是否存在于收藏列表,所述未加载时长为所述缓存图片最近一次被终端设备加载显示时间距离当前时间的时长,所述总加载时长为所述缓存图片被所述终端设备历史加载显示的时长总和;When the total picture cache is greater than a preset memory threshold, the priority of each cached picture is determined based on the favorite tag value, the unloaded time, and the total loaded time corresponding to the currently unloaded and displayed cached picture, respectively. It is used to indicate whether the cached picture exists in the favorite list, the unloaded time is the time when the cached picture was most recently loaded by the terminal device and the display time is away from the current time, and the total loaded time is the cached picture being used by the Sum of the duration of the terminal device history loading display;
    利用替换图片替换所述优先级低于预设级别的所述缓存图片,并将该缓存图片对应的图片链接与所述替换图片关联存储,所述替换图片根据该缓存图片对应的图片名确定;Using a replacement picture to replace the cache picture with a priority lower than a preset level, and storing a picture link corresponding to the cache picture with the replacement picture, and the replacement picture is determined according to a picture name corresponding to the cache picture;
    若完成替换操作后所述图片缓存总量大于所述内存阈值,按照优先级从低到高的顺序依次对所述缓存图片进行清理,直至所述图片缓存总量小于或等于所述内存阈值。If the total picture cache is greater than the memory threshold after completing the replacement operation, the cache pictures are cleaned in order from the lowest to the highest priority until the total picture cache is less than or equal to the memory threshold.
  2. 如权利要求1所述的图片缓存清理方法,其特征在于,所述基于当前未加载显示的缓存图片分别对应的收藏标记值、未加载时长以及总加载时长确定各所述缓存图片的优先级,包括:The method for cleaning a picture cache according to claim 1, wherein the priority of each cache picture is determined based on a favorite tag value, a non-load time, and a total load time corresponding to a currently unloaded and displayed cache picture, include:
    将存在于所述收藏列表的所述缓存图片设置为第一优先级,并判断不存在于所述收藏列表的所述缓存图片对应的所述未加载时长是否大于预设的第一时长阈值,以及对应的所述总加载时长是否大于预设的第二时长阈值;Setting the cached picture existing in the favorite list as a first priority, and judging whether the unloaded duration corresponding to the cached picture not existing in the favorite list is greater than a preset first duration threshold, And whether the corresponding total loading duration is greater than a preset second duration threshold;
    将不存在于所述收藏列表,且对应的所述未加载时长不大于所述第一时长阈值的所述缓存图片设置为第二优先级;Setting the cache picture that does not exist in the favorite list and the corresponding unloaded duration is not greater than the first duration threshold as a second priority;
    将不存在于所述收藏列表,且对应的所述未加载时长大于所述第一时长阈值,对应的所述总加载时长大于所述第二时长阈值的所述缓存图片设置为第三优先级;Setting the cache picture that does not exist in the favorite list and whose corresponding unloaded duration is greater than the first duration threshold and the corresponding total loaded duration is greater than the second duration threshold to a third priority ;
    将不存在于所述收藏列表,且对应的所述未加载时长大于所述第一时长阈值,对应的所述总加载时长不大于所述第二时长阈值的所述缓存图片设置为第四优先级;Setting the cache picture that does not exist in the favorite list and whose corresponding unloaded duration is greater than the first duration threshold and the corresponding total loaded duration is not greater than the second duration threshold as a fourth priority level;
    其中,所述第一优先级、所述第二优先级、所述第三优先级以及所述第四优先级的优先级级别依次降低。The priority levels of the first priority, the second priority, the third priority, and the fourth priority are sequentially decreased.
  3. 如权利要求1或2所述的图片缓存清理方法,其特征在于,所述按照优先级从低到高的顺序依次对所述缓存图片进行清理,包括:The method for cleaning a picture cache according to claim 1 or 2, wherein the cleaning the cache pictures in order from low to high priority comprises:
    基于各优先级对应的图片压缩率,按照优先级从低到高的顺序依次对所述缓存图片进行压缩,直至所述图片缓存总量小于或等于所述内存阈值,其中,所述图片压缩率大小与优先级负相关。Based on the picture compression rates corresponding to the priorities, the cached pictures are compressed in order from the lowest to the highest priority until the total picture cache is less than or equal to the memory threshold, where the picture compression rate Size is inversely related to priority.
  4. 如权利要求3所述的图片缓存清理方法,其特征在于,若压缩后的所述图片缓存总量大于所述内存阈值,按照优先级从低到高的顺序,依次对压缩后的所述缓存图片进行清理。The method for cleaning a picture cache according to claim 3, wherein if the total amount of the picture cache after compression is greater than the memory threshold, the compressed caches are sequentially sorted in order from low to high priority. Picture to clean up.
  5. 如权利要求4所述的图片缓存清理方法,其特征在于,所述按照优先级从低到高的顺序,依次对压缩后的所述缓存图片进行清理,包括:The method for cleaning a picture cache according to claim 4, wherein the step of sequentially cleaning the compressed pictures in a descending order of priority comprises:
    利用所述替换图片替换当前优先级的压缩后的所述缓存图片,并将该缓存图片对应的图片链接与所述替换图片关联存储。Using the replacement picture to replace the compressed cache picture at the current priority, and storing a picture link corresponding to the cache picture in association with the replacement picture.
  6. 一种图片缓存清理装置,其特征在于,包括:A picture cache cleaning device, comprising:
    优先级排序模块,用于当图片缓存总量大于预设的内存阈值时,基于当前未加载显示的缓存图片分别对应的收藏标记值、未加载时长以及总加载时长确定各所述缓存图片的优先级,所述收藏标记值用于标示所述缓存图片是否存在于收藏列表,所述未加载时长为所述缓存图片最近一次被终端设备加载显示时间距离当前时间的时长,所述总加载时长为所述缓存图片被所述终端设备历史加载显示的时长总和;The priority sorting module is configured to determine the priority of each cached picture based on the favorite tag value, the unloaded duration, and the total loaded duration of the currently unloaded displayed cached pictures when the total amount of the picture cache is greater than a preset memory threshold. Level, the favorite flag value is used to indicate whether the cached picture exists in the favorite list, the unloaded time is the time when the cached picture was last loaded by the terminal device and the display time is away from the current time, and the total loading time A total length of time during which the cached picture is loaded and displayed by the terminal device history;
    图片替换模块,用于利用替换图片替换所述优先级低于预设级别的所述缓存图片,并将该缓存图片对应的图片链接与所述替换图片关联存储,所述替换图片根据该缓存图片对应的图片名确定;A picture replacement module, configured to replace the cache picture with a priority lower than a preset level by using a replacement picture, and store a picture link corresponding to the cache picture with the replacement picture, and the replacement picture is based on the cache picture The corresponding picture name is determined;
    多级清理模块,用于若完成替换操作后所述图片缓存总量大于所述内存阈值,按照优先级从低到高的顺序依次对所述缓存图片进行清理,直至所述图片缓存总量小于或等于所述内存阈值。A multi-level cleaning module is used to clean up the cached pictures in order from the lowest to the highest priority if the total amount of the picture cache is greater than the memory threshold after the replacement operation is completed, until the total amount of the picture cache is less than Or equal to the memory threshold.
  7. 如权利要求6所述的图片缓存清理装置,其特征在于,所述优先级排序模块,包括:The picture cache cleaning device according to claim 6, wherein the priority ordering module comprises:
    将存在于所述收藏列表的所述缓存图片设置为第一优先级,并判断不存在于所述收藏列表的所述缓存图片对应的所述未加载时长是否大于预设的第一时长阈值,以及对应的所述总加载时长是否大于预设的第二时长阈值。Setting the cached picture existing in the favorite list as a first priority, and judging whether the unloaded duration corresponding to the cached picture not existing in the favorite list is greater than a preset first duration threshold, And whether the corresponding total loading duration is greater than a preset second duration threshold.
    将不存在于所述收藏列表,且对应的所述未加载时长不大于所述第一时长阈值的所述缓存图片设置为第二优先级。Setting the cache picture that does not exist in the favorite list and the corresponding unloaded duration is not greater than the first duration threshold as a second priority.
    将不存在于所述收藏列表,且对应的所述未加载时长大于所述第一时长阈值,对应的所述总加载时长大于所述第二时长阈值的所述缓存图片设置为第三优先级。Setting the cache picture that does not exist in the favorite list and whose corresponding unloaded duration is greater than the first duration threshold and the corresponding total loaded duration is greater than the second duration threshold to a third priority .
    将不存在于所述收藏列表,且对应的所述未加载时长大于所述第一时长阈值,对应的所述总加载时长不大于所述第二时长阈值的所述缓存图片设置为第四优先级。Setting the cache picture that does not exist in the favorite list and whose corresponding unloaded duration is greater than the first duration threshold and the corresponding total loaded duration is not greater than the second duration threshold as a fourth priority level.
    其中,所述第一优先级、所述第二优先级、所述第三优先级以及所述第四优先级的优先级级别依次降低。The priority levels of the first priority, the second priority, the third priority, and the fourth priority are sequentially decreased.
  8. 如权利要求6或7所述的图片缓存清理装置,其特征在于,所述多级清理模块,还包括:The picture cache cleaning device according to claim 6 or 7, wherein the multi-level cleaning module further comprises:
    压缩模块,用于基于各优先级对应的图片压缩率,按照优先级从低到高的顺序依次对所述缓存图片进行压缩,直至所述图片缓存总量小于或等于所述内存阈值,其中,所述图片压缩率大小与优先级负相关。A compression module, configured to compress the cached pictures in order from the lowest to the highest priority based on the picture compression rate corresponding to each priority until the total amount of picture cache is less than or equal to the memory threshold, The picture compression ratio is inversely related to the priority.
  9. 如权利要求8所述的图片缓存清理装置,其特征在于,所述多级清理模块,包括:The picture cache cleaning device according to claim 8, wherein the multi-level cleaning module comprises:
    二次清理模块,用于若压缩后的所述图片缓存总量大于所述内存阈值,按照优先级从低到高的顺序,依次对压缩后的所述缓存图片进行清理。A secondary cleaning module is configured to clean up the compressed cached pictures in order from the lowest to the highest priority if the total amount of the compressed picture cache is greater than the memory threshold.
  10. 如权利要求9所述的图片缓存清理装置,其特征在于,所述二次清理模块,包括:The picture cache cleaning device according to claim 9, wherein the secondary cleaning module comprises:
    利用所述替换图片替换当前优先级的压缩后的所述缓存图片,并将该缓存图片对应的图片链接与所述替换图片关联存储。Using the replacement picture to replace the compressed cache picture at the current priority, and storing a picture link corresponding to the cache picture in association with the replacement picture.
  11. 一种终端设备,其特征在于,所述终端设备包括存储器、处理器,所述存储器上存储有可在所述处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现如下步骤:A terminal device, characterized in that the terminal device includes a memory and a processor, and the memory stores computer-readable instructions executable on the processor, and the processor executes the computer-readable instructions To achieve the following steps:
    当图片缓存总量大于预设的内存阈值时,基于当前未加载显示的缓存图片分别对应的收藏标记值、未加载时长以及总加载时长确定各所述缓存图片的优先级,所述收藏标记值用于标示所述缓存图片是否存在于收藏列表,所述未加载时长为所述缓存图片最近一次被终端设备加载显示时间距离当前时间的时长,所述总加载时长为所述缓存图片被所述终端设备历史加载显示的时长总和;When the total picture cache is greater than a preset memory threshold, the priority of each cached picture is determined based on the favorite tag value, the unloaded time, and the total loaded time corresponding to the currently unloaded and displayed cached picture, respectively. It is used to indicate whether the cached picture exists in the favorite list, the unloaded time is the time when the cached picture was most recently loaded by the terminal device and the display time is away from the current time, and the total loaded time is the cached picture being used by the Sum of the duration of the terminal device history loading display;
    利用替换图片替换所述优先级低于预设级别的所述缓存图片,并将该缓存图片对应的图片链接与所述替换图片关联存储,所述替换图片根据该缓存图片对应的图片名确定;Using a replacement picture to replace the cache picture with a priority lower than a preset level, and storing a picture link corresponding to the cache picture with the replacement picture, and the replacement picture is determined according to a picture name corresponding to the cache picture;
    若完成替换操作后所述图片缓存总量大于所述内存阈值,按照优先级从低到高的顺序依次对所述缓存图片进行清理,直至所述图片缓存总量小于或等于所述内存阈值。If the total picture cache is greater than the memory threshold after completing the replacement operation, the cache pictures are cleaned in order from the lowest to the highest priority until the total picture cache is less than or equal to the memory threshold.
  12. 如权利要求11所述的终端设备,其特征在于,所述基于当前未加载显示的缓存图片分别对应的收藏标记值、未加载时长以及总加载时长确定各所述缓存图片的优先级,具体包括:The terminal device according to claim 11, wherein the determining the priority of each cached picture based on a favorite tag value, an unloaded duration, and a total loaded duration corresponding to a currently unloaded and displayed cached picture, specifically comprising :
    将存在于所述收藏列表的所述缓存图片设置为第一优先级,并判断不存在于所述收藏列表的所述缓存图片对应的所述未加载时长是否大于预设的第一时长阈值,以及对应的所述总加载时长是否大于预设的第二时长阈值;Setting the cached picture existing in the favorite list as a first priority, and judging whether the unloaded duration corresponding to the cached picture not existing in the favorite list is greater than a preset first duration threshold, And whether the corresponding total loading duration is greater than a preset second duration threshold;
    将不存在于所述收藏列表,且对应的所述未加载时长不大于所述第一时长阈值的所述缓存图片设置为第二优先级;Setting the cache picture that does not exist in the favorite list and the corresponding unloaded duration is not greater than the first duration threshold as a second priority;
    将不存在于所述收藏列表,且对应的所述未加载时长大于所述第一时长阈值,对应的所述总加载时长大于所述第二时长阈值的所述缓存图片设置为第三优先级;Setting the cache picture that does not exist in the favorite list and whose corresponding unloaded duration is greater than the first duration threshold and the corresponding total loaded duration is greater than the second duration threshold to a third priority ;
    将不存在于所述收藏列表,且对应的所述未加载时长大于所述第一时长阈值,对应的所述总加载时长不大于所述第二时长阈值的所述缓存图片设置为第四优先级;Setting the cache picture that does not exist in the favorite list and whose corresponding unloaded duration is greater than the first duration threshold and the corresponding total loaded duration is not greater than the second duration threshold as a fourth priority level;
    其中,所述第一优先级、所述第二优先级、所述第三优先级以及所述第四优先级的优先级级别依次降低。The priority levels of the first priority, the second priority, the third priority, and the fourth priority are sequentially decreased.
  13. 如权利要求11或12所述的终端设备,其特征在于,所述按照优先级从低到高的顺序依次对所述缓存图片进行清理,包括:The terminal device according to claim 11 or 12, wherein the cleaning the cached pictures in order from the lowest to the highest priority comprises:
    基于各优先级对应的图片压缩率,按照优先级从低到高的顺序依次对所述缓存图片进行压缩,直至所述图片缓存总量小于或等于所述内存阈值,其中,所述图片压缩率大小与优先级负相关。Based on the picture compression rates corresponding to the priorities, the cached pictures are compressed in order from the lowest to the highest priority until the total picture cache is less than or equal to the memory threshold, where the picture compression rate Size is inversely related to priority.
  14. 如权利要求13所述的终端设备,其特征在于,若压缩后的所述图片缓存总量大于所述内存阈值,按照优先级从低到高的顺序,依次对压缩后的所述缓存图片进行清理。The terminal device according to claim 13, characterized in that, if the total amount of the compressed picture cache is greater than the memory threshold, the compressed pictures are sequentially processed in the descending order of priority. Clean up.
  15. 如权利要求14所述的终端设备,其特征在于,所述按照优先级从低到高的顺序,依次对压缩后的所述缓存图片进行清理,包括:The terminal device according to claim 14, wherein the cleaning the compressed cache pictures in order from the lowest to the highest priority comprises:
    利用所述替换图片替换当前优先级的压缩后的所述缓存图片,并将该缓存图片对应的图片链接与所述替换图片关联存储。Using the replacement picture to replace the compressed cache picture at the current priority, and storing a picture link corresponding to the cache picture in association with the replacement picture.
  16. 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机可读指令,其特征在于,所述计算机可读指令被至少一个处理器执行时实现如下步骤:A computer-readable storage medium storing computer-readable instructions, wherein the computer-readable instructions implement the following steps when executed by at least one processor:
    当图片缓存总量大于预设的内存阈值时,基于当前未加载显示的缓存图片分别对应的收藏标记值、未加载时长以及总加载时长确定各所述缓存图片的优先级,所述收藏标记值用于标示所述缓存图片是否存在于收藏列表,所述未加载时长为所述缓存图片最近一次被终端设备加载显示时间距离当前时间的时长,所述总加载时长为所述缓存图片被所述终端设备历史加载显示的时长总和;When the total picture cache is greater than a preset memory threshold, the priority of each cached picture is determined based on the favorite tag value, the unloaded time, and the total loaded time corresponding to the currently unloaded and displayed cached picture, respectively. It is used to indicate whether the cached picture exists in the favorite list, the unloaded time is the time when the cached picture was most recently loaded by the terminal device and the display time is away from the current time, and the total loaded time is the cached picture being used by the Sum of the duration of the terminal device history loading display;
    利用替换图片替换所述优先级低于预设级别的所述缓存图片,并将该缓存图片对应的图片链接与所述替换图片关联存储,所述替换图片根据该缓存图片对应的图片名确定;Using a replacement picture to replace the cache picture with a priority lower than a preset level, and storing a picture link corresponding to the cache picture with the replacement picture, and the replacement picture is determined according to a picture name corresponding to the cache picture;
    若完成替换操作后所述图片缓存总量大于所述内存阈值,按照优先级从低到高的顺序依次对所述缓存图片进行清理,直至所述图片缓存总量小于或等于所述内存阈值。If the total picture cache is greater than the memory threshold after completing the replacement operation, the cache pictures are cleaned in order from the lowest to the highest priority until the total picture cache is less than or equal to the memory threshold.
  17. 根据权利要求16所述的计算机可读存储介质,其特征在于,所述基于当前未加载显示的缓存图片分别对应的收藏标记值、未加载时长以及总加载时长确定各所述缓存图片的优先级,包括:The computer-readable storage medium according to claim 16, wherein the priority of each cached picture is determined based on the favorite tag value, the unloaded duration, and the total loaded duration corresponding to the currently unloaded and displayed cached picture respectively. ,include:
    将存在于所述收藏列表的所述缓存图片设置为第一优先级,并判断不存在于所述收藏列表的所述缓存图片对应的所述未加载时长是否大于预设的第一时长阈值,以及对应的所述总加载时长是否大于预设的第二时长阈值;Setting the cached picture existing in the favorite list as a first priority, and judging whether the unloaded duration corresponding to the cached picture not existing in the favorite list is greater than a preset first duration threshold, And whether the corresponding total loading duration is greater than a preset second duration threshold;
    将不存在于所述收藏列表,且对应的所述未加载时长不大于所述第一时长阈值的所述缓存图片设置为第二优先级;Setting the cache picture that does not exist in the favorite list and the corresponding unloaded duration is not greater than the first duration threshold as a second priority;
    将不存在于所述收藏列表,且对应的所述未加载时长大于所述第一时长阈值,对应的所述总加载时长大于所述第二时长阈值的所述缓存图片设置为第三优先级;Setting the cache picture that does not exist in the favorite list and whose corresponding unloaded duration is greater than the first duration threshold and the corresponding total loaded duration is greater than the second duration threshold to a third priority ;
    将不存在于所述收藏列表,且对应的所述未加载时长大于所述第一时长阈值,对应的所述总加载时长不大于所述第二时长阈值的所述缓存图片设置为第四优先级;Setting the cache picture that does not exist in the favorite list and whose corresponding unloaded duration is greater than the first duration threshold and the corresponding total loaded duration is not greater than the second duration threshold as a fourth priority level;
    其中,所述第一优先级、所述第二优先级、所述第三优先级以及所述第四优先级的优先级级别依次降低。The priority levels of the first priority, the second priority, the third priority, and the fourth priority are sequentially decreased.
  18. 根据权利要求16或17所述的计算机可读存储介质,其特征在于,所述按照优先级从低到高的顺序依次对所述缓存图片进行清理,包括:The computer-readable storage medium according to claim 16 or 17, wherein the cleaning the cached pictures in order from low to high priority comprises:
    基于各优先级对应的图片压缩率,按照优先级从低到高的顺序依次对所述缓存图片进行压缩,直至所述图片缓存总量小于或等于所述内存阈值,其中,所述图片压缩率大小与优先级负相关。Based on the picture compression rates corresponding to the priorities, the cached pictures are compressed in order from the lowest to the highest priority until the total picture cache is less than or equal to the memory threshold, where the picture compression rate Size is inversely related to priority.
  19. 根据权利要求18所述的计算机可读存储介质,其特征在于,若压缩后的所述图片缓存总量大于所述内存阈值,按照优先级从低到高的顺序,依次对压缩后的所述缓存图片进行清理。The computer-readable storage medium according to claim 18, wherein if the total amount of the picture cache after compression is greater than the memory threshold, the compressed images are sequentially processed in order of priority from low to high. Cache images for cleaning.
  20. 根据权利要求19所述的计算机可读存储介质,其特征在于,所述按照优先级从低到高的顺序,依次对压缩后的所述缓存图片进行清理,包括:The computer-readable storage medium according to claim 19, wherein the step of sequentially cleaning the compressed cached pictures in order of priority from low to high comprises:
    利用所述替换图片替换当前优先级的压缩后的所述缓存图片,并将该缓存图片对应的图片链接与所述替换图片关联存储。Using the replacement picture to replace the compressed cache picture at the current priority, and storing a picture link corresponding to the cache picture in association with the replacement picture.
PCT/CN2018/104968 2018-07-06 2018-09-11 Image cache cleaning method and device, terminal device and medium WO2020006859A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201810736691.X 2018-07-06
CN201810736691.XA CN109299041A (en) 2018-07-06 2018-07-06 A kind of image cache method for cleaning and terminal device

Publications (1)

Publication Number Publication Date
WO2020006859A1 true WO2020006859A1 (en) 2020-01-09

Family

ID=65170492

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/104968 WO2020006859A1 (en) 2018-07-06 2018-09-11 Image cache cleaning method and device, terminal device and medium

Country Status (2)

Country Link
CN (1) CN109299041A (en)
WO (1) WO2020006859A1 (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH1115850A (en) * 1997-06-26 1999-01-22 Sumitomo Electric Ind Ltd Browsing device for mobil terminal
US20040064642A1 (en) * 2002-10-01 2004-04-01 James Roskind Automatic browser web cache resizing system
CN104484235A (en) * 2014-11-24 2015-04-01 北京奇虎科技有限公司 Memory optimization method and device based on waterfall stream technology
CN105893268A (en) * 2016-03-24 2016-08-24 北京小米移动软件有限公司 Cached image processing method and device
CN106897141A (en) * 2015-12-21 2017-06-27 北京奇虎科技有限公司 The processing method and processing device of information
CN107122454A (en) * 2017-04-26 2017-09-01 努比亚技术有限公司 A kind of image cache sweep-out method, equipment and computer-readable recording medium
CN107577757A (en) * 2017-08-31 2018-01-12 武汉斗鱼网络科技有限公司 Page waterfall stream layout optimization method, storage medium, electronic equipment and system

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH1115850A (en) * 1997-06-26 1999-01-22 Sumitomo Electric Ind Ltd Browsing device for mobil terminal
US20040064642A1 (en) * 2002-10-01 2004-04-01 James Roskind Automatic browser web cache resizing system
CN104484235A (en) * 2014-11-24 2015-04-01 北京奇虎科技有限公司 Memory optimization method and device based on waterfall stream technology
CN106897141A (en) * 2015-12-21 2017-06-27 北京奇虎科技有限公司 The processing method and processing device of information
CN105893268A (en) * 2016-03-24 2016-08-24 北京小米移动软件有限公司 Cached image processing method and device
CN107122454A (en) * 2017-04-26 2017-09-01 努比亚技术有限公司 A kind of image cache sweep-out method, equipment and computer-readable recording medium
CN107577757A (en) * 2017-08-31 2018-01-12 武汉斗鱼网络科技有限公司 Page waterfall stream layout optimization method, storage medium, electronic equipment and system

Also Published As

Publication number Publication date
CN109299041A (en) 2019-02-01

Similar Documents

Publication Publication Date Title
US10296591B2 (en) Efficient data distribution to multiple devices
KR102124231B1 (en) Streaming content and placeholders
JP6684881B2 (en) System and method for managing content items having multiple resolutions
US9166866B2 (en) Hydration and dehydration with placeholders
US8194730B2 (en) Efficient use of storage in encoding and decoding video data streams
KR101499372B1 (en) Graphics rendering methods for satisfying minimum frame rate requirements
US9201810B2 (en) Memory page eviction priority in mobile computing devices
US7945734B2 (en) Removable storage device with code to allow change detection
EP3008602B1 (en) Page-based compressed storage management
US7707603B2 (en) Digital media transfer based on user behavior
US8171251B2 (en) Data storage management method and device
AU2009268883B2 (en) System and method of regulating the download of data files from a server to a client device
US9747057B1 (en) Storage auto delete
JP5661104B2 (en) Method and system for search using search engine indexing and index
US20190073396A1 (en) Table partitioning and storage in a database
TWI283350B (en) Method for use in a controller of a computing device that comprises a system memory and a codec, computing system, controller and machine-readable medium comprising a plurality of instructions
US10133484B2 (en) Tier based data file management
CN104156410A (en) Method, system and device for providing application programs
US8375007B2 (en) Status tool to expose metadata read and write queues
JP2013528864A (en) Select content based on interest tags in the cloud of interest
KR100690804B1 (en) Method for executing garbage collection of mobile terminal
US10114865B2 (en) Tile cache
US20100076993A1 (en) Method and apparatus for remotely displaying a list by determining a quantity of data to send based on the list size and the display control size
WO2016101757A1 (en) Image processing method and device based on mobile device
JP2017512340A (en) Modified memory compression

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18925707

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE