USP_FAFEVENTDATACACHE_GET
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@DATA | xml | INOUT | |
@EVENTID | uniqueidentifier | IN | |
@CACHEKEY | nvarchar(512) | IN |
Definition
Copy
create procedure dbo.USP_FAFEVENTDATACACHE_GET
(
@DATA xml = null output,
@EVENTID uniqueidentifier,
@CACHEKEY nvarchar(512)
)
as
begin
declare @EXPIRATIONDATE as datetime;
declare @ISCALCULATING as bit;
declare @NOW as datetime;
set @NOW = GETDATE();
select
@DATA = DATA,
@EXPIRATIONDATE = EXPIRATIONDATE,
@ISCALCULATING = ISCALCULATING
from dbo.FAFEVENTDATACACHE
where EVENTID = @EVENTID and CACHEKEY = @CACHEKEY
if @DATA is not null -- cache exists
begin
if @NOW > @EXPIRATIONDATE -- expired
begin
if @ISCALCULATING = 0 -- no re-calculating thread running
begin
set @DATA = null; -- return no data so the caller has to calculate by itself
end
end
end
end