source: FOIAVistA/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/OCXCACHE.m@ 1495

Last change on this file since 1495 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 3.7 KB
Line 
1OCXCACHE ;SLC/RJS,CLA - ORDER CHECK CACHE CONTROLLER ;4/16/02 16:28
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**143**;Dec 17,1997
3 ;; ;;ORDER CHECK EXPERT version 1.01 released OCT 29,1998
4 ;
5GETDATA(OCXRES,OCXCALL,OCXDFN,OCXTIME) ;
6 ;
7 ;
8 N OCXDATA K OCXRES S OCXRES=""
9 ;
10 Q:'$L($G(OCXCALL)) 1
11 Q:'$L($G(OCXDFN)) 2
12 S ^XTMP("OCXCACHE",0)=$$FMADD^XLFDT($$NOW^XLFDT,1,"","","")_"^"_$$NOW^XLFDT
13 S:'$G(OCXTIME) OCXTIME=300
14 ;
15 K:($G(^XTMP("OCXCACHE",OCXDFN,OCXCALL,"TIME"))<$$NOW) ^XTMP("OCXCACHE",OCXDFN,OCXCALL)
16 ;
17 I '$D(^XTMP("OCXCACHE",OCXDFN,OCXCALL)) D
18 .I OCXCALL["$$" X "S OCXDATA="_OCXCALL
19 .E S OCXDATA="" D @OCXCALL
20 .M ^XTMP("OCXCACHE",OCXDFN,OCXCALL,"DATA")=OCXDATA
21 .S ^XTMP("OCXCACHE",OCXDFN,OCXCALL,"TIME")=$$NOW+OCXTIME
22 ;
23 M:$D(^XTMP("OCXCACHE",OCXDFN,OCXCALL,"DATA")) OCXRES=^XTMP("OCXCACHE",OCXDFN,OCXCALL,"DATA")
24 Q:'$D(^XTMP("OCXCACHE",OCXDFN,OCXCALL,"DATA")) 3
25 ;
26 Q 0
27 ;
28NOW() Q $P($H,",",2)+($H*86400)
29 ;
30PURGE ; Purge OCX namespaced entries in ^XTMP (Cache) that have expired.
31 ;
32 N OCXE0,OCXE1,OCXS
33 ;
34 ;S OCXS="OCX" F S OCXS=$O(^XTMP(OCXS)) Q:'$L(OCXS) Q:'($E(OCXS,1,3)="OCX") D
35 S OCXS="OCXCACHE" D
36 .S OCXE0=0 F S OCXE0=$O(^XTMP(OCXS,OCXE0)) Q:'$L(OCXE0) D
37 ..S OCXE1="" F S OCXE1=$O(^XTMP(OCXS,OCXE0,OCXE1)) Q:'$L(OCXE1) D
38 ...K:($G(^XTMP(OCXS,OCXE0,OCXE1,"TIME"))<$$NOW) ^XTMP(OCXS,OCXE0,OCXE1)
39 ;
40 Q
41 ;
42 ;Sample External Call
43 ;
44 ; S ORZ=$$LOCL^ORQQLR1(ORDFN,TEST,SPECIMEN)
45 ;
46 ; Changes to:
47 ;
48 ;S TEMP=$$GETDATA^OCXCACHE(.ORZ,"$$LOCL^ORQQLR1("_ORDFN_","_TEST_","_SPECIMEN_")",ORDFN,300)
49 ;
50 ;$$GETDATA^OCXCACHE(RESULTS,EXTERNAL CALL,PATIENT ID,TIMEOUT) ----> returns either a 1, 2, 3, or 0
51 ; 0 -> No Errors
52 ; 1 -> Missing External Call.
53 ; 2 -> Missing Patient ID.
54 ; 3 -> Cache Data Missing.
55 ;***Results = Data Value Returned,
56 ; Either Scalar or Array.
57 ;
58 ;***External Call = Routine call in a 'resolved parameter' format to
59 ; reduce the chances of cache returning the wrong values.
60 ;
61 ; If ORDFN=1234 and TEST=110 and SPECIMEN=119
62 ;
63 ; Then If this parameter is: "$$LOCL^ORQQLR1("_ORDFN_","_TEST_","_SPECIMEN_")"
64 ; then the value will be stored in subscript: "$$LOCL^ORQQLR1(1234,110,119)"
65 ;
66 ; If this parameter is: "$$LOCL^ORQQLR1(ORDFN,TEST,SPECIMEN)"
67 ; then the value will be stored in subscript: "$$LOCL^ORQQLR1(ORDFN,TEST,SPECIMEN)"
68 ;
69 ;***Object ID = If this is patient data then this will be the patient's DFN.
70 ; If this is user data then this will be the user's DUZ.
71 ; etc...
72 ;
73 ;***Timeout = (Optional Default = 300 (5 Minutes)) How long, in seconds, the data has to live in the cache.
74 ;
75 ;^XTMP("OCXCACHE",DFN,"$$LOCL^ORQQLR1(1234,110,119)","DATA")= Data
76 ;
77 ;^XTMP("OCXCACHE",DFN,"$$LOCL^ORQQLR1(1234,110,119)","TIME")= When the data will be deleted from the cache.
78 ;
79 ; $$NOW^OCXCACHE = The number of seconds since the "beginning of time". Used to determine if the data
80 ; node in the cache is past its expiration date or not.
81 ;
82 ; It is very important that ORMTIME is running if this routine is being used.
83 ; ORMTIME calls OCXOPURG which calls PURGE^OCXCACHE that cleans out expired data
84 ; in the cache. This will keep the cache from using up all the available diskspace
85 ; in the Volume Set or directory that ^XTMP resides in. PURGE^OCXCACHE can be run
86 ; manually from a programmer's prompt if needed.
87 ;
Note: See TracBrowser for help on using the repository browser.