using System.Collections.Generic;
using System.Threading.Tasks;
using Util.Helpers;
namespace Util.Caching.EasyCaching.Samples;
///
/// 缓存测试服务
///
public class CacheService : ICacheService {
///
/// 获取值
///
public string GetValue() {
return Id.Create();
}
///
/// 获取值 - 带一个简单参数
///
public string GetValue( int id ) {
return $"{Id.Create()}:{id}";
}
///
/// 异步获取值
///
public async Task GetValueAsync() {
await Task.Delay( 1 );
return Id.Create();
}
///
/// 获取对象集合
///
public List- GetItems() {
return new List
- { new ( "a", Id.Create() ), new( "a", Id.Create() ) };
}
///
/// 获取对象集合
///
public async Task
> GetItemsAsync( int id, string name, Item item, List- items ) {
await Task.Delay( 1 );
var result = new List
- ();
items.ForEach( t => {
var value = $"{id}-{name}-{item.Text}-{item.Value}-{t.Text}-{t.Value}";
result.Add( new Item( "",value ) );
} );
return result;
}
}