Results 1 to 3 of 3

Thread: QCache serialization

  1. #1

    Default QCache serialization

    Hello,

    I use QCache to keep frequently used images in memory, these images are generated with user interaction. When cache size is exceeded then old (not used for long time) images will be deleted - that is perfect for my needs. I need to be able to save the cache to file and restore it when application restarted next time. I can convert QCache to QMap and write it to disk through QDataStream, but then I loose information of frequently (recently) accessed objects. How can I preserve this information? Or is there a way to serialize QCache?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QCache serialization

    QCache doesn't expose such information especially that when you dump the cache, you need to read all its keys which makes the order useless (as the order becomes the order of which you dump the data). In general QCache should never be saved to disk, that's only a quick access cache, not a persistent one. It might be easier to implement your own cache if you really need something like that.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3

    Default Re: QCache serialization

    I will do my own implementation then. Thanks.

Similar Threads

  1. Class serialization
    By matulik in forum Qt Programming
    Replies: 6
    Last Post: 13th December 2010, 12:17
  2. Serialization of QTextEdit
    By naghekyan in forum Qt Programming
    Replies: 1
    Last Post: 16th August 2010, 06:02
  3. QtConcurent and QCache
    By baray98 in forum Qt Programming
    Replies: 6
    Last Post: 14th May 2010, 07:45
  4. Need help with serialization of QMaps
    By fg_psycho in forum Qt Programming
    Replies: 1
    Last Post: 5th May 2009, 17:16
  5. Serialization
    By donmorr in forum Qt Programming
    Replies: 4
    Last Post: 16th November 2006, 13:51

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.