Coherence cache query - distinct

Hi,
I am trying to find out how to do a distinct query in coherence cache. For example, if my key object has LastName, FirstName. How do I get the collection of keys of distinct last names? In another words, I am trying to find out what are the distinct Last names in the cache. Is there any filter can be used to do that?
Thanks.

Hi,
You can use DistinctValues aggregator.
http://download.oracle.com/docs/cd/E14526_01/coh.350/e14977/toc.htm
Wei
Edited by: welin on Jun 10, 2010 8:38 AM

Similar Messages

  • Simple UI to Query Coherence cache ?

    Hello to all Coherence Experts,
    My name is Goverdhan and I work for RBS. I am glad to be a part of this very active and informative forum. I had one question - do we have a query tool to query the coherence cache ? I mean - rather writing Java program for every query, do you know of any graphical user interface that would help in writing query and seeing result ? Like Toad, for example. It need not be as jazzy as toad - but, the idea is to have a simple UI and avoid writing Java program for every query. Any quick pointers in this direction is deeply appreciated.
    Please advise. We are urgently looking for a tool. Even if it is paid tool - please let me know. My email ids are :
    [email protected]
    [email protected]
    Thanks,
    Goverdhan

    Hi Goverdhan,
    SL Corp. are creating a Coherence Cache Viewer and Display Builder tool, which may be useful to you.
    You can send a mail to [email protected] to find out more about it.
    Best regards,
    Robert

  • Looking for some advice on CEP HA and Coherence cache

    We are looking for some advice or recommendation on CEP architecture.
    We need to build a CEP application that conforms to the following:
    • HA with no loss of events or duplicate events when failing over to the backup server.
    • We have some aggregative rules that needs to see all events.
    • Events are XMLs with size of 3KB-50KB. Not all elements are needed for the rules but they are there for other systems that come after the CEP (the customer services).
    • The XML elements that the CEP needs are in varying depth in the XML.
    Running the EPN on a single thread is not fast enough for the required throughput mainly because network latency to the JMS and the heavy task of parsing of the XML. Because of that we are looking for a solution that will read the messages from the JMS in parallel (multi thread) but will keep the same order of events between the Primary and Secondary CEPs.
    One idea that came to our minds is to use Coherence cache in the following way:
    • On the CEP inbound use a distributed queue and not topic (at the CEP outbound it is still topic).
    • On the CEPs side use a Coherence cache that runs on the CEPs JVMs (since we already have a Coherence cluster for HA).
    • Both CEPs read from the queue using multi threading (10 reading threads – total of 20 threads) and putting it to the Coherence cache.
    • The Coherence cache is publishing the events to both CEPs on a single thread.
    The EPN looks something like this:
    JMS adapter (multi threaded) -> replicated cache on both CEPs -> event bean -> HA adapter -> channel -> processor -> ….
    Does this sounds sound to you?
    Are we over shooting here? Is there a simpler solution for our needs?
    Is there a best practice for such requirements?
    Thanks

    Hi,
    Just to make it clear:
    We do not parse the XML on the event bean after the Coherence. We do it on the JMS adapter on multiple threads in order to utilize all the server resources (CPUs) and then we put it in the replicated cache.
    The requirements from our application are:
    - There is an aggregative query that needs to "see" all events (this means that we need to pass all events thru a single processor and we cannot partition them to several processors).
    - Because this is a HA solution the events on both CEPs (primary and secondary) needs to be at the same order when reaching the HA inbound adapter and the processor.
    - A single thread JMS adapter is not reading the messages from the JMS fast enough mainly because it takes time to parse the XML to an event.
    - Using a multi-threaded adapter or many single threaded adapters with message selector will create a situation that the order of events on both CEPs will not be the same at the processor inbound.
    This is why we needed a mediator so we can read in multiple threads that will parse the XMLs in parallel without concerning on order of messages and on the other hand publish all the messages on a single thread to the processors on both CEPs from this shared mediator (we use a replicated cache that runs on both JVMs).
    We use queue instead of topic because if we read the messages from a topic on both CEPs it will be stored twice on the Coherence replicated cache. But if we use a queue, when server 1 read the message and put it in the Coherence replicated cache then server 2 will not read it because it was removed from the queue.
    If I understand correctly you are suggesting replacing the JMS adapter with an event bean that will read the messages from the JMS directly?
    Are you also suggesting that we will not use a replicated cache but instead a stand alone cache on each server? In this case how do we keep the same order of events on both CEPs (on both caches)?

  • Coherence+JPA query issues

    Hello everyone,
    I've setup Coherence 3.6 to use JPA according to the generic instructions found here [http://coherence.oracle.com/display/COH35UG/Configuring+Coherence+for+JPA]
    This works fine and I can actually get data out of the DB backed cache. What I've found however is that CohSQL queries do not return anything unless the entry is already in Coherence. I'm using this piece of code to test query Coherence
    public <T> List<T> getAll(Class<T> type) {
            final List<T> data = new ArrayList<T>();
            Filter filter = QueryHelper.createFilter("value().class=?1", new Object[] { type });
            Set<Map.Entry<?, T>> filteredSet = cache.entrySet(filter);
            for (Map.Entry<?, T> t : filteredSet) {
                data.add(t.getValue());
            return Collections.unmodifiableList(data);
      }Should I be expecting Coherence to query the DB at this point, or is CohSQL confined to whatever's already in the cache?
    Thanks
    Edited by: 876420 on 01-Aug-2011 07:07

    Section 20 of the dev guide:
    "It should be noted that queries apply only to currently cached data (and will not use the CacheLoader interface to retrieve additional data that may satisfy the query). Thus, the data set should be loaded entirely into cache before queries are performed. In cases where the data set is too large to fit into available memory, it may be possible to restrict the cache contents along a specific dimension (for example, "date") and manually switch between cache queries and database queries based on the structure of the query. For maintainability, this is usually best implemented inside a cache-aware data access object (DAO)."
    Cheers,
    Steve

  • CQL Join on Coherence Cache with Composite Key

    I have a Coherence Cache with a composite key and I want to join a channel to records in that cache with a CQL processor. When I deploy the package containing the processor, I get the following error:
    +italics14:32:35,938 | alter query SimpleQuery start                                                                        | [ACTIVE] ExecuteThread: '7' for queue: 'weblogic.kernel.Default (self-tuning)' | CQLServer | FATAL+
    +14:32:35,938 | alter query >>SimpleQuery<< start+
    +specified predicate requires full scan of external source which is not supported. please modify the join predicate | [ACTIVE] ExecuteThread: '7' for queue: 'weblogic.kernel.Default (self-tuning)' | CQLServer | FATAL+
    I think that I'm using the entire key. If I change the key to a single field, it deploys OK. I found a similar issue when I defined a Java class to represent the composite key. Is it possible to join in this way on a composite key cache?
    I could define another field which is a concatenation of the fields in the composite key but this is a little messy.
    My config is as below:
    <wlevs:caching-system id="MyCache" provider="coherence" />
    <wlevs:event-type-repository>
    <wlevs:event-type type-name="SimpleEvent">
              <wlevs:properties>
                   <wlevs:property name="field1" type="char" />
                   <wlevs:property name="field2" type="char" />
              </wlevs:properties>
    </wlevs:event-type>
    </wlevs:event-type-repository>
         <wlevs:channel id="InChannel" event-type="SimpleEvent" >
              <wlevs:listener ref="SimpleProcessor" />
         </wlevs:channel>
         <wlevs:processor id="SimpleProcessor">
              <wlevs:listener ref="OutChannel" />
              <wlevs:cache-source ref="SimpleCache" />
         </wlevs:processor>
         <wlevs:channel id="OutChannel" event-type="SimpleEvent" >
         </wlevs:channel>
         <wlevs:cache id="SimpleCache" value-type="SimpleEvent"
              key-properties="field1,field2"
              caching-system="MyCache" >
         </wlevs:cache>
    and the processor CQL is as follows:
    <processor>
    <name>SimpleProcessor</name>
    <rules>
    <query id="SimpleQuery">
    <![CDATA[ 
                select I.field1, I.field2 from InChannel [now] as I,
    SimpleCache as S where
    I.field1 = S.field1 and
    I.field2 = S.field2
    ]]> </query>
    </rules>
    </processor>
    Thanks
    Mike

    Unfortunately, joining on composite keys in Coherence is not supported in the released versions. This will be supported in 12g release.
    As you mention, defining another field as key, which is the concatenation of the original keys is the workaround.

  • Architectural Choice for accessing Coherence Cache Server

    I am a newbie and have a coherence use-case question.
    When accessing an independent coherence cache server from application code such as an EJB deployed in WLS, architecturally does one write up an entity which is then used as a sole point of
    access to the resource (coherence cache server) for querying, adding, modifying entries or are the accesses to the coherence cache server split and spread among the application code.
    For example,
    1. I write an EJB (EJB 1) which recieves the request from other EJB's (EJB 2, EJB 3), EJB 1 runs requests from EJB2 and EJB 3 on the Coherence Cache Server and acts as the sole point of
    contact to the resource.
    2. EJB 2 and EJB 3 both run requests against the coherence cache server. No fixed entity in architecture repsonsible for interaction with Coherence Cache Server.
    Which is more common ?

    stevephe wrote:
    Yes you could treat Coherence as a "pluggable" resource, just like a database. But that, just like in the case of a database, wouldn't boil it down to a single entity/interface. You'd treat Coherence as a "integration tier" resource that you'd "plumb in" just like you would a database, thus shielding your application's "domain" objects from integration-level concerns. That's how I've tiered our application, although we aren't inside a container like Weblogic/WebSphere/etc. The domain objects specify their persistence requirements via a multiplicity of interfaces; those interfaces have a number of implementations in the integration tier, one set of which just happens to be a Coherence set. You can use a "registry" approach to pick up the appropriate implementations (we use Spring injection.) Have a look at the Coherence book from Apress for more details.Apress? You mean Packt, don't you?
    Best regards,
    Robert

  • Unable to connect to Coherence Cache by name

    I am trying to use Toplink Coherence Grid, and I have managed to get the server running and find all the jar files, but now I see this:
    Exception [EclipseLink-80000] (Eclipse Persistence Services - 2.0.2.v20100323-r6872): oracle.eclipselink.coherence.exceptions.IntegrationException
    Exception Description: Unable to connect to Coherence Cache by name: LogicalToPhysicalMapper.My LogicalToPhysicalMapper looks like this:
    @Customizer(CoherenceReadCustomizer.class)
    @IdClass(LogicalToPhysicalMapperPK.class)
    @Entity
    @NamedQueries({
      @NamedQuery(name = "LogicalToPhysicalMapper.findAll", query = "select o from LogicalToPhysicalMapper o")
    @Table(name = "LOGICAL_PHYSICAL_MAPPER")
    public class LogicalToPhysicalMapper implements Serializable {Here is persistence.xml:
    <?xml version="1.0" encoding="UTF8" ?>
    <persistence xmlns="http://java.sun.com/xml/ns/persistence"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
                 version="1.0">
      <persistence-unit name="ConfigStorePU"  transaction-type="JTA" >
          <provider>
            org.eclipse.persistence.jpa.PersistenceProvider
          </provider>
        <jta-data-source>jdbc/example/npp/npp_configStore</jta-data-source>
        <class>com.example.network.npp.configStore.SmsEndpoint</class>
        <class>com.example.network.npp.configStore.FeatureDependencies</class>
        <class>com.example.network.npp.configStore.LogicalToPhysicalMapper</class>
        <class>com.example.network.npp.configStore.bean.FeatureWorkflow</class>
        <class>com.example.network.npp.configStore.bean.Feature</class>
        <class>com.example.network.npp.configStore.bean.GenericMapper</class>
      </persistence-unit>
    </persistence>, and here is coherence-cache-config.xml:
    <?xml version="1.0"?>
    <!DOCTYPE cache-config SYSTEM "cache-config.dtd">
    <cache-config>
            <caching-scheme-mapping>
                    <cache-mapping>
                            <cache-name>*</cache-name>
                            <scheme-name>eclipselink-distributed-readonly</scheme-name>
                    </cache-mapping>
            </caching-scheme-mapping>
            <caching-schemes>
                    <distributed-scheme>
                            <scheme-name>eclipselink-distributed-readonly</scheme-name>
                            <service-name>EclipseLinkJPAReadOnly</service-name>
                            <!--
                                    Configure a wrapper serializer to support serialization of
                                    relationships.
                            -->
                            <serializer>
                                    <class-name>oracle.eclipselink.coherence.integrated.cache.WrapperSerializer
                                    </class-name>
                            </serializer>
                            <backing-map-scheme>
                                    <read-write-backing-map-scheme>
                                            <internal-cache-scheme>
                                                    <local-scheme />
                                            </internal-cache-scheme>
                                            <!-- Define the cache scheme -->
                                            <cachestore-scheme>
                                                    <class-scheme>
                                                            <class-name>oracle.eclipselink.coherence.integrated.EclipseLinkJPACacheLoader
                                                            </class-name>
                                                            <init-params>
                                                                    <init-param>
                                                                            <param-type>java.lang.String</param-type>
                                                                            <param-value>{cache-name}</param-value>
                                                                    </init-param>
                                                                    <init-param>
                                                                            <param-type>java.lang.String</param-type>
                                                                            <param-value>ConfigStorePU</param-value>
                                                                    </init-param>
                                                            </init-params>
                                                    </class-scheme>
                                            </cachestore-scheme>
                                            <read-only>true</read-only>
                                    </read-write-backing-map-scheme>
                            </backing-map-scheme>
                            <autostart>true</autostart>
                    </distributed-scheme>
            </caching-schemes>
    </cache-config>Anything obviously wrong here?
    Thanks.
    Running Weblogic 10.3.3.0 with Coherence 3.5.

    There are multiple ways to configure WebLogic with Coherence as described in the Active Cache guide but to define EAR scoped caches you need to deploy the jars to WebLogic as shared libraries, not put them on the server classpath. You can define shared libraries using the WLS Admin Console or you from the command line. Coherence and Active Cache jars deployment is described here: http://download.oracle.com/docs/cd/E21764_01/web.1111/e16517/coh_wls.htm#BABHAHJG and TopLink Grid here: http://download.oracle.com/docs/cd/E21764_01/web.1111/e16517/package_wls.htm#BABJCGIG
    --Shaun                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to pre-load Coherence Caches used within an OEP Application

    Hi OEP/Coherence guys,
    I'm currently developing an OEP application that was consuming database inputs in CQL queries.
    I've replaced database direct access by Coherence caches access. My Coherence Local caches use a cache loader to fetch rows (by key) when there is a cache miss. This is working well, and the caches get filled in during the execution of my OEP application.
    The problem is that if CQL queries are made on some attributes (not the key) of not-yet-cached data, the load method of my cache loader is not invoked and there is no result to my CQL query.
    I'm wondering how to pre-load my data in Coherence Caches, from the database, when the OEP application starts to avoid such kind of problems...
    Thx for any advice.
    Renato

    Hi.
    Could you please describe the way to "set-up a cache-loader to load data into your cache when the OEP application starts" ?
    I have a cache-loader configured with my cache. My cache-loader implements the "com.tangosol.net.cache.CacheLoader" interface.
    This interface only defines 2 methods:
    load(java.lang.Object oKey) ==> Return the value associated with the specified key, or null if the key does not have an associated value in the underlying store.
    loadAll(java.util.Collection colKeys) ==> Return the values associated with each the specified keys in the passed collection.
    None of these methods allows me to pre-load my data (and BTW it looks like "loadAll" is never called by OEP)
    Thx
    RP

  • External Coherence Cache

    Hello,
    Started using Coherence 3.6 and no issues in going through the tutorial.
    Also, from the web application code, was able to use weblogic server internal coherence cache.
    I want help for setting up the external Coherence cache. Any pointers ?
    Thank you for y our help.

    Hi,
    The Coherence product has a folder /bin where you will find script for running standalone/external Coherence cache servers.
    -cache-server.cmd : Execute multiple times the script and you will have multiple external coherence cache servers that can store/compute data
    -query.cmd: Execute sql like scripts to verify the data loaded the the Coherence Grid (Read the documentation at http://download.oracle.com/docs/cd/E15357_01/coh.360/e15723/api_cq.htm)
    -coherence.cmd: Execute for querying the Coherence Grid (Type help for commands)
    Also, I would recommend you to go through the developers' guide and Java APIs for understanding the Coherence capabilities. Here is the list of links that may be helpful for you. http://ora-soa.blogspot.com/2011/07/where-to-start-learning-coherence.html
    Cheers,
    NJ

  • Specifying coherence-cache-config.xml for multiple clusters

    Hi,
    I am running two cache clusters (Cluster A and B that hold different cache types). we have a web application that needs to communicate with both the clusters. we have two coherence-cache-config-g.xml files, one for each cluster.
    where do we specify the two coherence-cache-config.xml for each of these clusters in our coherence.jar that we deploy on the web app server.
    pls provide some inputs...
    thanks in advance,
    - G.

    Hi G,
    You can define a path to the cache configuration descriptor in your operation configuration override file (tangosol-coherence=override.xml) or specify it in the system property "tangosol.coherence.cacheconfig".
    Please see this Wiki page for details:
    http://wiki.tangosol.com/display/COH32UG/configurable-cache-factory-config
    Regards,
    Gene

  • How to specify index for cache in coherence-cache-config.xml

    Hi All,
    We want to apply indexing on cache data.
    Suppose i have a EMPLOYEE object in coherence cache.
    and i want to use employeeID for indexing purpose.
    Can anybody help me to achieve this at Congregational level i.e. using xml file (coherence-cache-config.xml) .
    Edited by: 981644 on Jan 16, 2013 1:51 AM

    Hi,
    I've posted some [url http://coherence.oracle.com/download/attachments/14647422/add-index-namespace.jar]code and the [url http://coherence.oracle.com/download/attachments/14647422/add-index-namespace-src.jar]source. It depends on coherence common version 2.3.0.39174 however I believe it will work with 2.0.0.23649 also. Coherence common library can be downloaded from [url http://coherence.oracle.com/display/INC10/coherence-common]here
    Note: This is purely an example on how to achieve index creation via a cache configuration file and is not a part of the product thus is not covered by product support.
    Here is an example cache configuration that uses the namespace:
    <cache-config xmlns:service="class://com.oracle.coherence.environment.extensible.ServiceOperations">
        <caching-scheme-mapping>
            <service:index-add cache-name="dist-indexes">
                <extractor>
                    <class-name>ReflectionExtractor</class-name>
                    <init-params>
                        <init-param>
                            <param-type>string</param-type>
                            <param-value>getName</param-value>
                        </init-param>
                    </init-params>
                </extractor>
            </service:index-add>
            <!-- Simplified POF Config -->
            <service:index-add cache-name="dist-indexes" pof-enabled="true">
                <pof-index>8,16,32</pof-index>
            </service:index-add>
            <!-- This should not be counted based on system-property override -->
            <service:index-add cache-name="dist-indexes" pof-enabled="true" enabled="{tangosol.index.add}">
                <pof-index>8,16,31</pof-index>
            </service:index-add>
            <!-- Explicit POF Config -->
            <service:index-add cache-name="dist-indexes">
                <extractor>
                    <class-name>PofExtractor</class-name>
                    <init-params>
                        <init-param>
                            <param-type>{class}</param-type>
                            <param-value>null</param-value>
                        </init-param>
                        <init-param>
                            <param-type>{object}</param-type>
                            <param-value>
                                <class-name>com.tangosol.io.pof.reflect.SimplePofPath</class-name>
                                <init-params>
                                    <init-param>
                                        <param-type>{int[]}</param-type>
                                        <param-value>1,2,4</param-value>
                                    </init-param>
                                </init-params>                     
                            </param-value>
                        </init-param>
                    </init-params>
                </extractor>
            </service:index-add>
        </caching-scheme-mapping>
    </cache-config>Thanks,
    Harvey

  • How to share the same coherence cache in two EPN

    hi,all:
    I need to share the same coherence cache in two EPN. to put data into this coherence cache.
    only whe EPN can been deploy ok, the other EPN deploy will get below exception.
    Caused By: java.lang.IllegalStateException: Service "synergy-scheme-service" has been started by the factory with a different configuration descriptor
    at com.tangosol.net.DefaultConfigurableCacheFactory.validateBackingMapManager(DefaultConfigurableCacheFactory.java:1246)
    who can tell me why? or who can give me a example on how to share the same coherence cache in two EPN.
    thanks a lots

    Hi,
    This is because the system detects that you are using different configuration for the cache of the same name(and the domain name). If you want, we can discuss it, my mail is [email protected]
    Thanks
    Junger

  • Verify whether the session data is kept in the Coherence caches

    I have successfully combined the MapViewer application with WebLogic and Oracle Coherence*Web.
    How to verify whether the session data of MapViewer application is kept in the Coherence caches or not?
    All out put show that both of MapViewer and WebLogic server as well as Coherence are running well.
    All the following steps are right?
    The procedure is as the following:
    1. Create a WebLogic domain: Map_domain.
    2. Start the WebLogic domain Map_domain by running startWebLogic.sh script.
    3. Install Coherence.jar as a library on WebLogic.
    4. Copy the coherence.jar in the WAR's WEB-INF/lib directory.
    5. Create a reference to the shared library by modifying the weblogic.xml in web applications WEB-INF directory
    and add the following contents:
    <weblogic-web-app>
         <library-ref>
              <library-name>coherence-web-spi</library-name>
              <specification-version>1.0.0.0</specification-version>
              <implementation-version>1.0.0.0</implementation-version>
              <exact-match>false</exact-match>
         </library-ref>
    <weblogic-web-app>6. Install Coherence-web-spi.war as a WebLogic library.
    7. Install the MapViewer as a WebLogic application.
    8. Start a Coherence cache server using the cmd file web-cache-server.cmd and then start MapViewer application.
    The content of web-cache-server.cmd file:
    @echo off
    @rem This will start a cache server
    setlocal
    :config
    @rem specify the Coherence installation directory
    set coherence_home=F:\coherence
    @rem specify the JVM heap size
    set memory=256m
    :start
    if not exist "%coherence_home%\lib\coherence.jar" goto instructions
    if "%java_home%"=="" (set java_exec=java) else (set java_exec=%java_home%\bin\java)
    :launch
    set java_opts="-Xms%memory% -Xmx%memory%"
    "%java_exec%" -server -showversion "%java_opts%" -cp %coherence_home%\lib\coherence.jar;
    %coherence_home%\lib\coherence-web-spi.war
    -Dtangosol.coherence.management.remote=true
    -Dtangosol.coherence.cacheconfig=WEB-INF/classes/session-cache-config.xml
    -Dtangosol.coherence.session.localstorage=true
    com.tangosol.net.DefaultCacheServer %1
    goto exit
    :instructions
    echo Usage:
    echo   ^<coherence_home^>\bin\cache-server.cmd
    goto exit
    :exit
    endlocal
    @echo onEdited by: jetq on Jan 13, 2010 9:32 AM

    Any opinions are welcome.

  • Implementing Oracle DCN with Coherence Cache in a weblogic 10 app server

    I m trying to implements a DCN ( Database change notification ) on oracle to notify a listener of an event of DB so I can update Coherence Cache.
    I followed the tutorial here and it is working fine using a sample program with a main method to execute the listener class and keep it running.
    My question is how would this notification and listener gets implemented on a production environment since my local test was only running a main method to keep the listener running? what technology to use to keep the listener always running on the background and receive the notification from the database )?
    would a [weblogic startup class|http://docs.oracle.com/cd/E13222_01/wls/docs81/ConsoleHelp/startup_shutdown.html] work for this purpose?
    We are using Weblogic 10 as our app server.

    That's a very simple question with (many) potentially complex answers. I think that first uou need to study information on TimesTen to understand what it is and what it does. Then you need to relate that to you current performance bottleneck (I assume you have analysed those). If your bottleneck is database access then maybe TimesTen can help you.
    Please bear in mind that TimesTen is not a 'transparent' drop in performance booster. To implement TimesTen and to realise significant performance improvement you will almost certainly need to make changes to both the application and the overall architecture. The cost/difficulty of doing that also needs to be factored in.
    Chris

  • Caching Query Issues?

    I have a test(on the server) and a development(localhost) sites so is the oracle database schemas.  Both Oracle database schemas reside on the same server. I have the same datasource name for both schemas in the CF Administrators (local and server). For some reason, it seems to me that the data being pulled only from the test environment database eventhough I run the code on the development(localhost).  I cleared the cache on the CF administrator.   Any advise would be great.  Thanks.

    Soumen Mondal,
    If you are facing this problem from the same client PC and in the same session, it's very strange.. but if there are two sessions running on the same PC this kind of issue may come..
    Something about caching:
    To decide whether to cache a query or not, consider the number of times you intend to run the query in a minute. For data changing in seconds, and queried in minutes, I would recommend not to cache query at all.
    I may give a typical example for query caching in a query on material master cached for 24 hours, where we know that after creating material master, we are not creating a PO on the same day.
    BR,
    SB

Maybe you are looking for