Skip to content

Commit

Permalink
merge code for demo project
Browse files Browse the repository at this point in the history
  • Loading branch information
ibireme committed Mar 28, 2016
1 parent 4eba044 commit 59364fe
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions YYWebImage/Cache/YYKVStorage.m
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,8 @@ - (NSMutableArray *)_dbGetFilenamesWithTimeEarlierThan:(int)time {
return filenames;
}

- (NSMutableArray *)_dbGetItemSizeInfoOrderByTimeDescWithLimit:(int)count {
NSString *sql = @"select key, filename, size from manifest order by last_access_time desc limit ?1;";
- (NSMutableArray *)_dbGetItemSizeInfoOrderByTimeAscWithLimit:(int)count {
NSString *sql = @"select key, filename, size from manifest order by last_access_time asc limit ?1;";
sqlite3_stmt *stmt = [self _dbPrepareStmt:sql];
if (!stmt) return nil;
sqlite3_bind_int(stmt, 1, count);
Expand Down Expand Up @@ -841,7 +841,7 @@ - (BOOL)removeItemsToFitSize:(int)maxSize {
BOOL suc = NO;
do {
int perCount = 16;
items = [self _dbGetItemSizeInfoOrderByTimeDescWithLimit:perCount];
items = [self _dbGetItemSizeInfoOrderByTimeAscWithLimit:perCount];
for (YYKVStorageItem *item in items) {
if (total > maxSize) {
if (item.filename) {
Expand Down Expand Up @@ -871,7 +871,7 @@ - (BOOL)removeItemsToFitCount:(int)maxCount {
BOOL suc = NO;
do {
int perCount = 16;
items = [self _dbGetItemSizeInfoOrderByTimeDescWithLimit:perCount];
items = [self _dbGetItemSizeInfoOrderByTimeAscWithLimit:perCount];
for (YYKVStorageItem *item in items) {
if (total > maxCount) {
if (item.filename) {
Expand Down Expand Up @@ -909,7 +909,7 @@ - (void)removeAllItemsWithProgressBlock:(void(^)(int removedCount, int totalCoun
NSArray *items = nil;
BOOL suc = NO;
do {
items = [self _dbGetItemSizeInfoOrderByTimeDescWithLimit:perCount];
items = [self _dbGetItemSizeInfoOrderByTimeAscWithLimit:perCount];
for (YYKVStorageItem *item in items) {
if (left > 0) {
if (item.filename) {
Expand Down

0 comments on commit 59364fe

Please sign in to comment.