コード例 #1
0
        public void ModifyPackage()
        {
            var         watch   = Stopwatch.StartNew();
            UserPackage package = PersonalCacheStruct.GetOrAdd("10000", new Lazy <UserPackage>(() =>
            {
                return(new UserPackage()
                {
                    UserId = 10000
                });
            }));

            package.ModifyLocked(() =>
            {
                package.Items[100] = 1;
            });
            WaitEnd(watch);
        }