CN101566945A - Method for flexibly using weak reference cache object - Google Patents
Method for flexibly using weak reference cache object Download PDFInfo
- Publication number
- CN101566945A CN101566945A CNA2008101051310A CN200810105131A CN101566945A CN 101566945 A CN101566945 A CN 101566945A CN A2008101051310 A CNA2008101051310 A CN A2008101051310A CN 200810105131 A CN200810105131 A CN 200810105131A CN 101566945 A CN101566945 A CN 101566945A
- Authority
- CN
- China
- Prior art keywords
- weak reference
- management system
- manager
- weak
- recovered
- Prior art date
- Legal status (The legal status 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 status listed.)
- Pending
Links
Images
Abstract
The invention relates to a method for flexibly using a weak reference cache object, which comprises the following steps that: a weak reference management system is established; an application program adds an object needing to perform weak reference management to the weak reference management system, and appoints a key value of the object; the weak reference management system generates a weak reference manager for the object, and uses the weak reference manager to give reference to the object in a weak reference mode; the weak reference management system adds the weak reference manager to an assembly; the application program initiates a request of loading the object to the weak reference management system, and appoints the key value of the object; the weak reference management system inquiries the weak reference manager for the assembly according to the key value; the weak reference management system requests the referenced object from the weak reference manager; and a recoverer of the weak reference manager checks all the weak reference managers periodically, and finally the managers of which the objects are recovered are eliminated. The method flexibly uses a weak reference technique provided by .NET to cache the object in the development of the .NET.
Description
Technical field
The present invention relates to a kind of method of flexible use weak reference cache object, particularly a kind of employing in .NET exploitation, the method that the weak reference technique that using .NET is flexibly provided is come cache object.
Background technology
The object that when creating, compares consumes resources, if this object can be reused, then the weak reference technique that can use .NET to provide is come this object of temporary cache, and the internal memory reclaim mechanism of .NET can reclaim this weak reference object, but still can use before reclaiming.
When reusing, can visit this object so earlier and whether also exist, the wasting of resources that is caused when creating this object to reduce.
The present invention will use a kind of more efficient methods to pack this weak reference technique, so that bring into play its effect better.
Summary of the invention
Technical matters to be solved by this invention provides a kind of employing in the .NET exploitation, the method that the weak reference technique that using .NET is flexibly provided is come cache object.
The method of a kind of flexible use weak reference cache object of the present invention, this method comprises following step at least:
Step 1: set up weak reference management system.
Step 2: application program is added the object that needs carry out the weak reference management in the weak reference management system to, and specifies the key assignments of this object.
Step 3: weak reference management system generates the weak reference manager for this object.
Step 4: the weak reference manager is quoted this object in the mode of weak reference.
Step 5: weak reference management system is added the weak reference manager in the set to.
Step 6: application program initiates to load the request of object to weak reference management system, specifies the key assignments of this object simultaneously.
Step 7: weak reference management system inquires the weak reference manager according to key assignments from set.
Step 8: the object that weak reference management system is quoted to the weak reference manager request.
Step 9:, inform that then this object of weak reference management system is recovered if this object is recovered; Otherwise object is returned to weak reference management system.
Step 10: if this object is recovered, then weak reference management system is removed this weak reference manager; Otherwise this object is returned to application program.
Step 11: all weak reference managers of the recover quantitative check of weak reference manager, remove those managers that its object has been recovered.
The method of a kind of flexible use weak reference cache object of the present invention is set up weak reference management system, the steps include:
Step 11: add the object of coming in to carry out the weak reference management at each,, quote this object by the mode of weak reference for it generates a weak reference manager.
Step 12: the object that the weak reference manager is quoted might be recovered, and will have a timed task like this and remove the weak reference manager that object has been recovered.This timed task is called the recover of weak reference manager.
The method of a kind of flexible use weak reference cache object that the present invention relates to makes that the weak reference technique that using .NET is flexibly provided is come cache object in the .NET exploitation.
Description of drawings
Fig. 1 is a process flow diagram of the present invention.
Embodiment
Referring to Fig. 1, key step of the present invention is as follows:
Step 1: set up weak reference management system.
Step 2: application program is added the object that needs carry out the weak reference management in the weak reference management system to, and specifies the key assignments of this object.
Step 3: weak reference management system generates the weak reference manager for this object.
Step 4: the weak reference manager is quoted this object in the mode of weak reference.
Step 5: weak reference management system is added the weak reference manager in the set to.
Step 6: application program initiates to load the request of object to weak reference management system, specifies the key assignments of this object simultaneously.
Step 7: weak reference management system inquires the weak reference manager according to key assignments from set.
Step 8: the object that weak reference management system is quoted to the weak reference manager request.
Step 9:, inform that then this object of weak reference management system is recovered if this object is recovered; Otherwise object is returned to weak reference management system.
Step 10: if this object is recovered, then weak reference management system is removed this weak reference manager; Otherwise this object is returned to application program.
Step 11: all weak reference managers of the recover quantitative check of weak reference manager, remove those managers that its object has been recovered.
The concrete steps that above-mentioned steps 1 is set up weak reference management system are as follows:
Step 11: add the object of coming in to carry out the weak reference management at each,, quote this object by the mode of weak reference for it generates a weak reference manager.
Step 12: the object that the weak reference manager is quoted might be recovered, and will have a timed task like this and remove the weak reference manager that object has been recovered.This timed task is called the recover of weak reference manager.
Above-mentioned technical scheme makes when implementing that the weak reference technique that using .NET is flexibly provided is come cache object in the .NET exploitation.
It should be noted last that above embodiment is only in order to explanation and unrestricted technical scheme described in the invention; Therefore, although this instructions has been described in detail the present invention with reference to the above embodiments,, those of ordinary skill in the art should be appreciated that still and can make amendment or replacement to the present invention with being equal to; And all do not break away from the technical scheme and the improvement thereof of the spirit and scope of the present invention, and it all should be encompassed in the middle of the claim scope of the present invention.
Claims (2)
1, a kind of method of flexible use weak reference cache object, it is characterized in that: this method comprises following step at least:
Step 1: set up weak reference management system.
Step 2: application program is added the object that needs carry out the weak reference management in the weak reference management system to, and specifies the key assignments of this object.
Step 3: weak reference management system generates the weak reference manager for this object.
Step 4: the weak reference manager is quoted this object in the mode of weak reference.
Step 5: weak reference management system is added the weak reference manager in the set to.
Step 6: application program initiates to load the request of object to weak reference management system, specifies the key assignments of this object simultaneously.
Step 7: weak reference management system inquires the weak reference manager according to key assignments from set.
Step 8: the object that weak reference management system is quoted to the weak reference manager request.
Step 9:, inform that then this object of weak reference management system is recovered if this object is recovered; Otherwise object is returned to weak reference management system.
Step 10: if this object is recovered, then weak reference management system is removed this weak reference manager; Otherwise this object is returned to application program.
Step 11: all weak reference managers of the recover quantitative check of weak reference manager, remove those managers that its object has been recovered.
2, the method for a kind of flexible use weak reference cache object according to claim 1 is characterized in that: set up weak reference management system, the steps include:
Step 11: add the object of coming in to carry out the weak reference management at each,, quote this object by the mode of weak reference for it generates a weak reference manager.
Step 12: the object that the weak reference manager is quoted might be recovered, and will have a timed task like this and remove the weak reference manager that object has been recovered.This timed task is called the recover of weak reference manager.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CNA2008101051310A CN101566945A (en) | 2008-04-25 | 2008-04-25 | Method for flexibly using weak reference cache object |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CNA2008101051310A CN101566945A (en) | 2008-04-25 | 2008-04-25 | Method for flexibly using weak reference cache object |
Publications (1)
Publication Number | Publication Date |
---|---|
CN101566945A true CN101566945A (en) | 2009-10-28 |
Family
ID=41283108
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CNA2008101051310A Pending CN101566945A (en) | 2008-04-25 | 2008-04-25 | Method for flexibly using weak reference cache object |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN101566945A (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101794221B (en) * | 2009-12-30 | 2012-08-08 | 飞天诚信科技股份有限公司 | Compression method and device of reference types in .net file |
CN103678357A (en) * | 2012-09-13 | 2014-03-26 | 腾讯科技(深圳)有限公司 | Method and device for obtaining picture thumbnail through mobile terminal |
CN104516745A (en) * | 2013-09-27 | 2015-04-15 | 北京新媒传信科技有限公司 | Method and system for running timing task |
CN105607900A (en) * | 2015-11-26 | 2016-05-25 | 小米科技有限责任公司 | Display object processing method and apparatus |
CN106020822A (en) * | 2016-05-18 | 2016-10-12 | 腾讯科技(成都)有限公司 | Weak reference implementation method and device oriented to Pool object |
-
2008
- 2008-04-25 CN CNA2008101051310A patent/CN101566945A/en active Pending
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101794221B (en) * | 2009-12-30 | 2012-08-08 | 飞天诚信科技股份有限公司 | Compression method and device of reference types in .net file |
CN103678357A (en) * | 2012-09-13 | 2014-03-26 | 腾讯科技(深圳)有限公司 | Method and device for obtaining picture thumbnail through mobile terminal |
CN104516745A (en) * | 2013-09-27 | 2015-04-15 | 北京新媒传信科技有限公司 | Method and system for running timing task |
CN104516745B (en) * | 2013-09-27 | 2018-09-04 | 北京新媒传信科技有限公司 | A kind of method and system of run timing task |
CN105607900A (en) * | 2015-11-26 | 2016-05-25 | 小米科技有限责任公司 | Display object processing method and apparatus |
CN106020822A (en) * | 2016-05-18 | 2016-10-12 | 腾讯科技(成都)有限公司 | Weak reference implementation method and device oriented to Pool object |
CN106020822B (en) * | 2016-05-18 | 2019-03-26 | 腾讯科技(成都)有限公司 | Weak reference implementation method and device towards Pool object |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN101566945A (en) | Method for flexibly using weak reference cache object | |
CN106354562A (en) | Memory cleaning system and memory cleaning method | |
CN100449562C (en) | License control method and device | |
CN102103642B (en) | Data-erasure method based on OLTP, system and graphic data base server | |
CN101964725B (en) | Method and system for realizing upgrading without interrupting service | |
CN101178669A (en) | Resource recovery method and apparatus | |
CN101636000A (en) | Treating method and treatment device of alarm storms | |
CN108304178B (en) | Unity 3D-based data set reference method and system | |
CN1855057A (en) | System and method for providing bundle group termination in an OSGi service platform | |
CN108509284A (en) | A kind of tree shaped model task management system applied to functional expression programming | |
CN108829415B (en) | Model loading method, server and computer readable storage medium | |
CN101557390A (en) | Method for improving system performance by flexibly using cache technology | |
CN101894049A (en) | System and method for recycling garbage object in self-adaptive way | |
CN101383814A (en) | Device and method implementing data access based on connection pool | |
CN104731634A (en) | Real-time online distributive calculation frame implementing method | |
Meng et al. | On semantics and refinement of UML statecharts: a coalgebraic view | |
CN103188306B (en) | Distributed preprocess method and system | |
CN110941422B (en) | Code automatic generation method, code generator and readable storage medium | |
CN106201692A (en) | A kind of timing task processing system and method | |
CN103095833A (en) | Updating method of cloud service system and device | |
CN102497410A (en) | Method for dynamically partitioning computing resources of cloud computing system | |
CN102694687B (en) | Batched configuration command issuing network management method and device | |
US20050149615A1 (en) | System and method for processing resource registry updates without regard to chronological order | |
CN102087607A (en) | Method and device for installing patch packets | |
CN103593190A (en) | Application processing method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C02 | Deemed withdrawal of patent application after publication (patent law 2001) | ||
WD01 | Invention patent application deemed withdrawn after publication |
Open date: 20091028 |