+  HandyCache форум
|-+  Главная категория» English forum» limit cache
Имя пользователя:
Пароль:
Страниц: [1]   Вниз
  Отправить эту тему    Печать  
Автор Тема: limit cache  (Прочитано 3245 раз)
0 Пользователей и 1 Гость смотрят эту тему.
kyushadow
Новичок
*

Репутация: +0/-0
Offline Offline

Сообщений: 29



« : 31 октября 2012, 00:43:27 »

my third question in this forum, hopefully member of this forum, admin and founder not get bored
with my question and help me answer it Веселый

how to limit cache that save in handycache beetween 0 - 1 giga?? more that 1 giga handycache
should not save the file, example : there's 5 client and all of them download file extension exe

client 1 download file capacity is 200 mega
client 2 download file capacity is 300 mega
client 3 download file capacity is 400 mega
client 4 download file capacity is 500 mega
client 5 download file capacity is 2 giga

of course all the file is save in handycache because already rules in save to cache,
but i wan't to make an exception, file only from client 1-4 that save by handycache
but client 5 is not save by handycache because the file is more than 1 giga

what should i do?? or i have to wrote my own extention on handycache using lua???
« Последнее редактирование: 31 октября 2012, 00:48:50 от kyushadow » Сообщить модератору   Записан

IMPOSSIBLE IS NOTHING
mirny
Пользователь
**

Репутация: +11/-1
Offline Offline

Сообщений: 84


« Ответ #1 : 31 октября 2012, 11:38:53 »

> have to wrote my own extention
Yep, it's simple. Here's a script you can base your extension on (just to give you the idea — replace "dont_update" with "dont_save")
Caution: it's pretty ancient and wouldn't work as is anymore. It has to be redone into a proper extension.
Код:
--***************************************************************
-- Script for HandyCache v 1.00 RC1 (1.0.0.11)
-- Author: DenZzz
-- What for: Don't update files depending on size
--***************************************************************

function GetContentLength(s)
  _,_,x = string.find(s, "[cC]ontent%-[lL]ength: *(%d+)")
  if x==nil then return -1 else return tonumber(x) end
end


function main()

  -- GET-requests only
  if hc_method == "GET" then

    len = GetContentLength(hc_header)

    if len > 1000 then
      if hc_cache_file_size == len then
        hc_action = "dont_update"
      end 
    end
  end
end
Сообщить модератору   Записан
kyushadow
Новичок
*

Репутация: +0/-0
Offline Offline

Сообщений: 29



« Ответ #2 : 31 октября 2012, 16:46:24 »

Mirny,

 Благодарю like always many thanks  Отлично!
Сообщить модератору   Записан

IMPOSSIBLE IS NOTHING
Страниц: [1]   Вверх
  Отправить эту тему    Печать  

 
Перейти в: