Multi-session handling: apply MatrixKit changes into Console.

This commit is contained in:
giomfo
2015-05-28 17:54:50 +02:00
parent a8b01c264d
commit 5cbd906199
9 changed files with 233 additions and 157 deletions
@@ -698,29 +698,34 @@ NSString* const kCommandsDescriptionText = @"The following commands are availabl
#pragma mark - Cache handling
// return the MX cache size in bytes
- (NSUInteger) MXCacheSize {
- (NSUInteger)MXCacheSize {
if (self.mxSession.store && [self.mxSession.store isKindOfClass:[MXFileStore class]]) {
MXFileStore *fileStore = (MXFileStore*)self.mxSession.store;
return fileStore.diskUsage;
NSUInteger cacheSize = 0;
NSArray *mxSessions = self.mxSessions;
for (MXSession *mxSession in mxSessions) {
if (mxSession.store && [mxSession.store isKindOfClass:[MXFileStore class]]) {
MXFileStore *fileStore = (MXFileStore*)mxSession.store;
cacheSize += fileStore.diskUsage;
}
}
return 0;
return cacheSize;
}
// return the sum of the caches (MX cache + media cache ...) in bytes
- (NSUInteger) cachesSize {
- (NSUInteger)cachesSize {
return self.MXCacheSize + [MXKMediaManager cacheSize];
}
// defines the min allow cache size in bytes
- (NSUInteger) minCachesSize {
- (NSUInteger)minCachesSize {
// add a 50MB margin to avoid cache file deletion
return self.MXCacheSize + [MXKMediaManager minCacheSize] + 50 * 1024 * 1024;
}
// defines the current max caches size in bytes
- (NSUInteger) currentMaxCachesSize {
- (NSUInteger)currentMaxCachesSize {
return self.MXCacheSize + [MXKMediaManager currentMaxCacheSize];
}