If you are just invalidating, and that is not working, are you sure your variables contain the correct values?
Original Message:
Sent: Wed April 24, 2024 02:38 PM
From: Joseph Morgan
Subject: dp:invalidate-cached-documents()
I'd have to check, but just because they're invalidated doesn't mean they are flushed, so they may not be removed. Do you want to invalidate or flush? If you flush, try dp:flush-documents or dp:flush-expired-documents?
If you are just invalidating, and that is not working, are you sure your variables contain the correct values?
If so, have you tried by hand via, say, the web UI to invalidate and typing in the expected values?
------------------------------
Joseph Morgan
Original Message:
Sent: Tue April 23, 2024 06:50 PM
From: Suresh Sanga
Subject: dp:invalidate-cached-documents()
Has anyone has an example on the gateway script for the
dp:invalidate-cached-documents() function?
I tried in xslt and it is not working. Any suggestions are greatly appreciated. I have to invalidate the cache entry if one of the api matches and I dont see the document id is getting removed when I look at the document status in DataPower. Here is my xslt.
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:dp="http://www.datapower.com/extensions"
xmlns:dpconfig="http://www.datapower.com/param/config" extension-element-prefixes="dp" exclude-result-prefixes="dp dpconfig">
<xsl:variable name="dpDomainName" select="dp:variable('var://service/domain-name')"/>
<xsl:variable name="dpXMLManagerName" select="dp:variable('var://service/xmlmgr-name')"/>
<xsl:variable name="dpURI" select="dp:variable('var://service/URI')"/>
<xsl:variable name="securityToken">
<xsl:value-of select="dp:http-request-header('securityToken')"/> <!-- 94500D8B17E64A38A21B128C336C2BD0-->
</xsl:variable>
<xsl:variable name="dpCachePattern">
<xsl:value-of select="'*'"/>
</xsl:variable>
<xsl:param name="dpconfig:sessionEndpoint" select="'http://DEVF1_localhost:9008'"/>
<xsl:template match="/">
<xsl:variable name="CallEndPoint" select="normalize-space($dpconfig:sessionEndpoint)"/>
<xsl:variable name="AuthEndPoint" select="concat($CallEndPoint,'/CWValidateAuthToken?',$securityToken)"/>
<xsl:choose>
<xsl:when test="contains($dpURI,'/session/impersonate')">
<xsl:variable name="dpCacheValues" select="dp:invalidate-cached-documents($dpDomainName, $dpXMLManagerName, $AuthEndPoint, $dpCachePattern)"/>
<xsl:if test="$dpCacheValues > 0">
<xsl:message>Found entries and invalidated</xsl:message>
</xsl:if>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
------------------------------
Suresh Sanga
------------------------------