Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How setCaching works?
Qt 6.11 is out! See what's new in the release blog

How setCaching works?

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 1.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    qwe3
    wrote on last edited by
    #1

    Hi,

    I would like to check many times ( for example in a loop ) if file exists. This file is in a share folder ( samba ) and sometimes this share folder isn't exists. I check QFileInfo class and I find method setCaching. So I thought, that if I did:

        QFileInfo fileInfo(R"(\\192.168.200.200\someFile.txt)");
        fileInfo.setCaching(false);
        for(int i=0;i<10;i++)
        {
            qInfo()<<fileInfo.exists();
        }
    

    I will have to check 10 times for example 25 seconds ( so for all 250 seconds ). But I have to wait only once - 25 seconds. Next 9 times was very fast ( less than 1 seconds for all ), so ( 26 seconds for all ).

    I would like to check if file exists 10 times, not using cache, so I would like to wait 250 seconds.

    I know about connectToHost, but this method sometimes not works for me ( I know that folder exists ( I can go to it using windows explorer ), but connectToHost can't connect to it ).

    JonBJ 1 Reply Last reply
    0
    • Q qwe3

      Hi,

      I would like to check many times ( for example in a loop ) if file exists. This file is in a share folder ( samba ) and sometimes this share folder isn't exists. I check QFileInfo class and I find method setCaching. So I thought, that if I did:

          QFileInfo fileInfo(R"(\\192.168.200.200\someFile.txt)");
          fileInfo.setCaching(false);
          for(int i=0;i<10;i++)
          {
              qInfo()<<fileInfo.exists();
          }
      

      I will have to check 10 times for example 25 seconds ( so for all 250 seconds ). But I have to wait only once - 25 seconds. Next 9 times was very fast ( less than 1 seconds for all ), so ( 26 seconds for all ).

      I would like to check if file exists 10 times, not using cache, so I would like to wait 250 seconds.

      I know about connectToHost, but this method sometimes not works for me ( I know that folder exists ( I can go to it using windows explorer ), but connectToHost can't connect to it ).

      JonBJ Online
      JonBJ Online
      JonB
      wrote on last edited by
      #2

      @qwe3
      The timing may have nothing to do with Qt implementation code (especially with your no caching). It may be that the timings/behaviour come from the OS/Samba behaviour.

      1 Reply Last reply
      0
      • JoeCFDJ Offline
        JoeCFDJ Offline
        JoeCFD
        wrote on last edited by
        #3
        This post is deleted!
        1 Reply Last reply
        0
        • JoeCFDJ Offline
          JoeCFDJ Offline
          JoeCFD
          wrote on last edited by
          #4

          https://forum.qt.io/topic/87578/issue-with-qfilesystemwatcher-in-linux-system-with-directory-shared-by-windows-using-cifs-protocol/9

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved