Forum Discussion

Hugh123's avatar
Hugh123
Icon for Nimbostratus rankNimbostratus
Aug 04, 2011

c# get_ramcache_entry()

So I've been struggling attempting to call the get_ramcache_entry() from my c application. Specifically, I'm unsure what I should be passing to the function to get the information out. I've tried setting individual key values for profile_name, maximum_responses, etc, but whenever I plug these into the method, I get an invalid arguments exception.

 

 

Anyone have any luck getting this to work?

 

7 Replies

  • Have you looked at the SDK Example?

     

     

    http://devcentral.f5.com/wiki/iControl.LocalLB__RAMCacheInformation__get_ramcache_entry.ashx

     

     

    If so, can you post the code sample?
  • Hello sir, I have looked at this example, but am still unsure how to call the method with the keys. Here's what I have so far:

     
    iControl.LocalLBRAMCacheInformationRAMCacheKey key2 = new iControl.LocalLBRAMCacheInformationRAMCacheKey();
    LocalLBRAMCacheInformationRAMCacheEntry[] RamE;
    Interfaces m_interfaces = new Interfaces();
    m_interfaces.initialize(ipAddress, user, pass);
                                   
    key2.maximum_responses = 500;
    key2.profile_name = "";
    RamE = m_interfaces.LocalLBRAMCacheInformation.evict_all_ramcache_entries(); <-- Not sure what to put here
    

    I've tried entering the key2.maximum_responses and key2.profile_name, but get either invalid arguments, or method doesn't take x arguments.
  • An "evict_all_ramcache_entries" takes no parameters.

     

     

    It should work as long as your HTTP Profile Name and Partition match.

     

     

    http://devcentral.f5.com/wiki/iControl.LocalLB__RAMCacheInformation__evict_all_ramcache_entries.ashx
  • Hi sir,

     

     

    Thanks for the response. However, I don't think that's going to work. What we're trying to do is be able to query the ramcache entries for a specific profile, and only evict on the specified one, instead of clearing the cache for all profiles. Unless I'm misinterpreting your post?
  • OK. I think I see the disconnect. I apologize.

     

     

    There are three methods for doing this:

     

     

     

    evict_all_ramcache_entries Resets/evicts all cache entries. BIG-IP_v9.0.5

     

    evict_ramcache_entry Note: This function has been deprecated. Please use evict_ramcache_entry_v2. Resets/evicts the cache entries associated with the specified keys. Note: The "max_responses" field in each RAMCacheKey key is ignored in this method. BIG-IP_v9.0.5

     

    evict_ramcache_entry_v2 Resets/evicts the cache entries associated with the specified keys. Note: The "max_responses" field in each RAMCacheKey key is ignored in this method.

     

     

     

    The first takes no input and flushes the entire RAMCache.

     

     

     

    The second was deprecated.

     

     

    I think that you will need to use the third (evict_ramcache_entry_v2). It takes the following Parameters:

     

     

     

    http://devcentral.f5.com/wiki/iCont...ry_v2.ashx

     

     

     

    Parameter Type Description

     

    keys RAMCacheKey[] The keys used to evict the RAM cache entries.

     

    exact_match boolean Whether to look for an exact match for host and uri. If exact, you must specify host and uri in the key. If non-exact, host and uri can be a subset of the text in a matched entry during the search.

     

     

     

    I haven't used this method yet but I am currently working on a thick client application for this and will post the method when I have it completed.

     

     

     

  • Hi sir,

    We figured this out, with the great wonder that is dubdub. I was instantiating the keys incorrectly, which was causing the error. While we did have to use the evict_ramcache_entry_v2 method due to the original one being deprecated, we were able to get this to work to specify which http_profile we wanted to clear the cache for.

     
    LocalLBRAMCacheInformationRAMCacheKey prof_key = new LocalLBRAMCacheInformationRAMCacheKey();
    LocalLBRAMCacheInformationRAMCacheKey[] keys = new LocalLBRAMCacheInformationRAMCacheKey[] { prof_key };
    
    Interfaces m_interfaces = new Interfaces();
    m_interfaces.initialize(ipAddress, user, pass);
    
    prof_key.host_name = "";              
    prof_key.maximum_responses = 500;
    prof_key.profile_name = "";
    prof_key.uri = "";
    
    m_interfaces.LocalLBRAMCacheInformation.evict_ramcache_entry_v2(keys, false);
    
    

    Thanks for your help!

    Matt
  • I should add, in addition, we were able to get the get_ramcache_entries working as well. This will allow us to query how many objects the profile currently has to evict, prior to removing, them, then validate that the eviction was successfully completed.

     

     

    Matt