C 公共類 快取幫助類 (備忘)

2021-10-10 09:57:29 字數 2908 閱讀 3966

using system;

using system.collections.generic;

using system.text;

using system.threading;

namespace librarycommon

#endregion

#region work method

static

void

workproc()

} removels.

foreach

(key =

> cachedictionary.

remove

(key));

} mutex.

releasemutex()

; thread.

sleep(10

);}}

#endregion

#region add method

public

static

bool

add(

string key,

object val,

datetime delaytime,

bool issliding)

else

cachedictionary[key]

= entity;

mutex.

releasemutex()

;return

true;}

public

static

bool

add(

string key,

object val,

timespan timespan,

bool issliding)

public

static

bool

add(

string key,

object val)

public

static

bool

add(

string key,

object val,

timespan timespan)

#endregion

#region set

public

static

bool

set(

string key,

object obj)

mutex.

releasemutex()

;return retbl;

}#endregion

#region remove method

public

void

remove

(string key)

mutex.

releasemutex()

;}#endregion

#region other method

public

static

void

setdiccount

(ushort len)

public

static

void

setlimtdiccount

(bool islimit)

public

static

bool

setdelaytime

(string key,

datetime delaytime)

else

retbl =

true;}

mutex.

releasemutex()

;return retbl;

}public

static

bool

setdelaytime

(string key,

timespan timespan)

///

/// 設定滑動過期時間

///

/// 鍵key

/// 是否滑動過期

/// 該實體必須具有時間過期功能,否則設定不成功

public

static

bool

setslidtime

(string key,

bool isslid)

} mutex.

releasemutex()

;return retbl;

}#endregion

#region get mothod

///

/// 獲取快取中的乙個值

///

/// 快取中的的key

/// 如果該值不存在則返還null

public

static

object

get(

string key)

obj = cacheentity.valueinfo;

} mutex.

releasemutex()

;return obj;

}#endregion

#region inner calss

class

cacheinfo

public

object valueinfo

public

datetime starttime

public

timespan delaytime

public

bool isslidingover

public

bool i***pirationtime

}#endregion

}}

C 公共幫助類 Image幫助類

大家知道,開發專案除了資料訪問層很重要外,就是common了,這裡就提供了強大且實用的工具。c 公共幫助類 convert幫助類 image類 using system using system.collections.generic using system.text using system.i...

C 公共幫助類 分頁邏輯處理類

分頁邏輯處理類 pagecollection.cs 1 using system 2using system.collections.generic 3using system.linq 4using system.text 56 namespace common717 18 當前頁面 19 20p...

清除快取幫助類

在android中清除快取的功能是較為常見的。public class cleanmessagehelper return getformatsize cachesize param context 刪除快取 public static void clearallcache context cont...