私はちょうど実験をしました。私は100万個のオブジェクトを保存しました(ps:サービスマンのバグがあり、1回だけ約50万個のオブジェクトを保存できます)。
これらの2つの方法で照会します。
DateTime beginDate = DateTime.Now;
Debug.WriteLine("查询1开始");`
Website site = WebsiteRedis.GetByCondition(w => w.Name == "网址2336677").First();
double time = (DateTime.Now - beginDate).TotalMilliseconds;
Debug.WriteLine("耗时:" + time + "ms");
DateTime beginDate2 = DateTime.Now;
Debug.WriteLine("查询2开始");
Website site2 = WebsiteRedis.GetByID(new Guid("29284415-5de0-4781-bea4-5e01332814b2"));
double time2 = (DateTime.Now - beginDate2).TotalMilliseconds;
Debug.WriteLine("耗时:" + time2 + "ms");
結果は
GetAll().Where()
ある -
GetById()
、19秒かかる - 190msを取ります。
私はそれがすべてのオブジェクトは、IDと関連し、クエリとしてGetById()
を使用する必要があり、クエリとしてGetAll().Where()
を使用しないので、決して、redis
キーとしてservicestack
使用のオブジェクトIDためだと思います。 GetAll()
は、レコードの少ないオブジェクトで使用する必要があります。
ベストアンサーには、それを試してみることです... – BugFinder
@BugFinderあなたは正しいです、私は今夜試してみると、私はあなたの人に知らせる。 – Bucketcode