Comments (11)
There are many occurrences that can cause TMMemoryCache
to release memory, such as setting a costLimit
or calling any of the following methods (or their asynchronous counterparts). But yes, UIApplicationDidReceiveMemoryWarning
will no longer have any effect on TMMemoryCache
by default. If you want this behavior in 2.0, you will need to add it yourself using the lines of code you pasted above.
/**
Removes the object for the specified key. This method blocks the calling thread until the object
has been removed.
@param key The key associated with the object to be removed.
*/
- (void)removeObjectForKey:(NSString *)key;
/**
Removes all objects from the cache that have not been used since the specified date.
This method blocks the calling thread until the cache has been trimmed.
@param date Objects that haven't been accessed since this date are removed from the cache.
*/
- (void)trimToDate:(NSDate *)date;
/**
Removes objects from the cache, costliest objects first, until the <totalCost> is below the specified
value. This method blocks the calling thread until the cache has been trimmed.
@param cost The total accumulation allowed to remain after the cache has been trimmed.
*/
- (void)trimToCost:(NSUInteger)cost;
/**
Removes objects from the cache, ordered by date (least recently used first), until the <totalCost> is below
the specified value. This method blocks the calling thread until the cache has been trimmed.
@param cost The total accumulation allowed to remain after the cache has been trimmed.
*/
- (void)trimToCostByDate:(NSUInteger)cost;
/**
Removes all objects from the cache. This method blocks the calling thread until the cache has been cleared.
*/
- (void)removeAllObjects;
from tmcache.
Thanks for quick reply. I think handle memory warnings is the default behaviour for Cache which is 1.0 before. The 2.0 strategy is a bit unusual. I think it would be better if it is noticed in README.md
, not only in release change log.
from tmcache.
The reason it no longer does this is because TMCache
can be used in extensions which cannot refer to the shared application.
I will update the README tomorrow.
from tmcache.
@irace you can still listen for the notification without referencing the shared application?
from tmcache.
Yeah, that's true actually. Not sure why I didn't think of that.
I can put out a new version that adds this back tomorrow. Unfortunately, I guess by semver rules this would mean bumping the library to 3.0 ๐
from tmcache.
Nah it's a feature, so 2.1 should be sufficient
-Samuel E. Giddins
On May 7, 2015, at 8:53 PM, Bryan Irace [email protected] wrote:
Reopened #85.
โ
Reply to this email directly or view it on GitHub.
from tmcache.
Breaks API compatibility though?
from tmcache.
How?
-Samuel E. Giddins
segiddins.me
On May 7, 2015, at 9:11 PM, Bryan Irace [email protected] wrote:
Breaks API compatibility though?
โ
Reply to this email directly or view it on GitHub.
from tmcache.
I would remove the two new public methods I added in 2.0 for telling the cache that the app was backgrounds or that a memory warning occurred.
from tmcache.
No need to remove them, you can just deprecate them.
-Samuel E. Giddins
On May 7, 2015, at 9:24 PM, Bryan Irace [email protected] wrote:
I would remove the two new public methods I added in 2.0 for telling the cache that the app was backgrounds or that a memory warning occurred.
โ
Reply to this email directly or view it on GitHub.
from tmcache.
Fixed in version 2.1.0
from tmcache.
Related Issues (20)
- cache life time HOT 4
- Update changelog HOT 2
- NSInternalInconsistencyException
- question about cost limit HOT 3
- Completion block is not called HOT 2
- [email protected]
- ageLimit is not an ageLimit
- "byteCount" get the wrong value after caching multiple times on the same key HOT 4
- disscuss about thread safe HOT 3
- No changelog for 2.0? HOT 2
- Memory warning block did not execute
- Advice on usage for offline solution HOT 3
- TMDiskCache's enumerateObjectsWithBlock doesn't return objects HOT 1
- setObject not working
- setObject generates .dat.nosync instead of normal cache file in the path. HOT 2
- ไฝ ๅฅฝ
- investigate TMCache update
- crash in NSKeyedUnarchiver unarchiveObjectWithFile HOT 2
- ๆญป้้ฎ้ขๆไบบๅจ็ไน
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tmcache.