Extract variable from LookupCache

Hello

How can I get the value of the variable that is inside the tag called <AssignTo> with policy ExtractVariables  ??

 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<LookupCache continueOnError="false" enabled="true" name="LC-testLookupCache">
<DisplayName>LC-testLookupCache</DisplayName>
<Properties/>
<CacheKey>
<Prefix/>
<KeyFragment>apivar</KeyFragment>
<KeyFragment ref="request.queryparam.myvar"/>
</CacheKey>
<CacheResource>my_cache</CacheResource>
<Scope>Exclusive</Scope>
<AssignTo>myvar</AssignTo>  -- I need the value of this variable called "myvar"
</LookupCache>
0 1 51
1 REPLY 1


@jcds101092 wrote:

How can I get the value of the variable


You would "get it" by referencing that variable in some other policy. For example, after the LookupCache, you could then use AssignMessage to inject that variable into a request header which will be sent to the upstream system. If your lookupCache assigns to the variable named variable_set_from_lookupcache, then the subsequent AssignMessage might be like this:

 

<AssignMessage name='AM-Inject-Header'> 
  <!-- 
   When this policy is attached to the request flow, it will
   inject a header into the request that will be sent to the 
   upstream system.
  -->
  <Set> 
    <Headers> 
      <Header name='new-header'>{variable_set_from_lookupcache}</Header>
    </Headers>
  </Set>
</AssignMessage>