1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Lack of Interest Caching external images

Discussion in 'Closed Suggestions' started by cedivad, Aug 10, 2010.

  1. cedivad

    cedivad Active Member

    Every external image (from signature pic to post images from imageshack.us) is cached. Every url is replaced. Example:

    Not cached:
    http://somesite.com/pic.jpg

    xF detects it's an image (it's supposed to be if it's inside the [ img ] tag) and replace the url above to:
    http://mysite.com/cache.php?url=http://somesite.com/pic.jpg

    This have multiple functions:
    1) load the image faster
    2) if the image gets deleted you have a local copy of it
    3) page than load faster

    Google for example, does it.

    I know i will not see it here soon, but maybe you can put it in your TODO list.
     
    KURTZ likes this.
  2. Brogan

    Brogan XenForo Moderator Staff Member

    How and when would the cache be updated?

    It would have to be done periodically due to images on the remote servers changing.
     
  3. cedivad

    cedivad Active Member

    Images are supposed to stay the same =)
    Why should they change?
     
  4. Brogan

    Brogan XenForo Moderator Staff Member

    I change images all the time on my server, especially if they are charts related to current season standings.
     
  5. Onimua

    Onimua Well-Known Member

    Some are dynamic, like the trophy/post/like signatures that are being used by a lot of members at the moment.
     
  6. cedivad

    cedivad Active Member

    Than using a database you can have it recached every 24hours...
    I think i will have to code it myself.
     
  7. Onimua

    Onimua Well-Known Member

    Which is fine, but it adds a lot to the database over a short period of time and from a practicality stand point just isn't worth it. I don't think this would ever be a default option.
     
  8. Brogan

    Brogan XenForo Moderator Staff Member

    Indeed.

    Recaching the entire contents of a locally stored image folder on a large forum could take some time, not to mention the amount of storage needed.
     
  9. Disjunto

    Disjunto Well-Known Member

    yey, dynamic images :D
     
  10. cedivad

    cedivad Active Member

    SELECT(*) queries are really really fast... usually. Even if you have a 100M records database.
    Let's say that the most useful point is that you will be able to keep topic images even after they are deleted on the server they comes from, that would be really usefull over a decade.
     
  11. Onimua

    Onimua Well-Known Member

    A single query may be fast, but they add up when you combine them with others. Depending on how active your board is and the type of discussion, that is a lot of updating, deleting, and writing going on at once just to save external images, never mind trying to update user information, Alerts, email subscriptions, etc.

    If you want to save images on your database, encourage people to use the attachement system.
     
  12. Brogan

    Brogan XenForo Moderator Staff Member

    This.
     
  13. cedivad

    cedivad Active Member

    However by thinking about it it can be done by using the timestamp of the last edit of the files on the local filesystem, no db required at all.
     
  14. Onimua

    Onimua Well-Known Member

    In order to check timestamps, you still need to communicate with the database and do a comparison.
     
  15. cedivad

    cedivad Active Member

    No. You get the last edit time from the fileinfo of the file on the local filesystem. If the difference from time() is greater than x seconds you have to update it.
     
  16. Walter

    Walter Well-Known Member

    SELECT * isnt fast. The contrary is true. The less columns you fetch the less network traffic or memory is used. Why fetch unnecessary columns?

    And your caching idea is nice but it will only work ony small forums. Imagine a forum with 100,000 or millions of posts and how big the cache will grow...
     
  17. cedivad

    cedivad Active Member

    Some tera of data?
    100M posts * 1M image every 10 post = 10TB of images
     
  18. cedivad

    cedivad Active Member

    SELECT with index and LIMIT 1 is really really fast.
     
  19. cedivad

    cedivad Active Member

    Sorry, didn't get that first. Simply because you have 2 or 3 columns, so it's faster to write * rather than the field ids.
    However you can select only one field, no problems at all =)
     
  20. Floris

    Floris Guest

    I don't think it's for the site to cache them, but I like he idea. I just don't want to host other people their images, even in a cache, really. I will have a more indepth thinking about this. Interesting suggestion.
     

Share This Page