コード例 #1
0
        /// <summary>
        /// Ensures that an entry has a key.
        /// </summary>
        /// <param name="entry">The entry.</param>
        private void EnsureKey(ReadOnlyLazyEntry <TKey, TValue> entry)
        {
            if (entry.HasKey)
            {
                return;
            }

            entry.Key = _serializationService.ToObject <TKey>(entry.KeyData);
        }
コード例 #2
0
        /// <summary>
        /// Ensures that an entry has a value.
        /// </summary>
        /// <param name="entry">The entry.</param>
        private void EnsureValue(ReadOnlyLazyEntry <TValue> entry)
        {
            if (entry.HasValue)
            {
                return;
            }

            entry.Value = _serializationService.ToObject <TValue>(entry.ValueData);
        }
コード例 #3
0
        /// <summary>
        /// Ensures that a cache entry has a value.
        /// </summary>
        /// <param name="entry">The cache entry.</param>
        private void EnsureValue(ReadOnlyLazyEntry <TValue> entry)
        {
            if (entry.HasValue)
            {
                return;
            }

            // accepted race-condition here

            entry.Value = _serializationService.ToObject <TValue>(entry.ValueData);
        }