spGetCacheItem

Parameters

Parameter Parameter Type Mode Description
@Key nvarchar(255) IN
@Exact bit IN

Definition

Copy

            CREATE Procedure [dbo].[spGetCacheItem]
            (
                @Key        nvarchar(255),
                @Exact        bit
            )
            AS

            -- This table represents items currently open in cache.
            -- Items may be dropped from cache as a result of app reset, memory constraints, time expirations
            -- and not be removed from this table.  To clean up unused items, we will purge them after 1 day.
            declare @D smalldatetime
            set @D =  DATEADD(d, -1, GETUTCDATE())            
            delete from dbo.CacheItems where CacheItems.DateAdded < @D

            if len(@Key)=0
                select [Key],[DateAdded]  from CacheItems 
            else
                if @Exact =1
                    select [Key],[DateAdded]  from CacheItems where [key]=@key
                else
                    select [Key],[DateAdded]  from CacheItems where [key] like @key + '%'