WARNING: This server is unstable and will be retired in the next days. If you want to keep this forum available, please request immediately a migration on the Nabble Support forum. Forums that don't receive any migration request will be deleted forever.

JCS Key Length Issue -- limited to 256 characters long?

View: New views
3 Messages — Rating Filter:   Alert me  

JCS Key Length Issue -- limited to 256 characters long?

by fox1964 :: Rate this Message:

| View Threaded | Show Only this Message

I have a program to download files from remote sites.   Once downloaded a data file, I use the URL as a key and put it to the cache so that I don't have to download it again if the url is found to exist in the cache.   However, I found sometimes the caching would fail -- no caching is put to the file system ( I am using Disk File Cache).   the url is working fine for downloading.   After debugging, it turns out that the URL string is too long.   When the url string exceeds 256 characters, JCS won't accept it as a proper key.  

So my questions are:
1.) is a JCS cache key limited to 256 chars long?   is there a way to increase its length?
2.) If can not get around the cache key length limitation, what could be the possible ways to make a long URL string short enough but still unique enough to serve as a key?  I tried to use the last 256 characters from the url string, but some query string is so long that it could not guarantee a key's uniqueness.

Any suggestions.

[JCS] Re: JCS Key Length Issue -- limited to 256 characters long?

by Thomas Vandahl-2 :: Rate this Message:

| View Threaded | Show Only this Message

First of all: Please use user@... for questions regarding
JCS.

On 04.01.12 18:12, Chopin hu wrote:
> I have a program to download files from remote sites.   Once downloaded a data file, I use the URL as a key and put it to the cache so that I don't have to download it again if the url is found to exist in the cache.   However, I found sometimes the caching would fail -- no caching is put to the file system ( I am using Disk File Cache).   the url is working fine for downloading.   After debugging, it turns out that the URL string is too long.   When the url string exceeds 256 characters, JCS won't accept it as a proper key.  
>
> So my questions are:
> 1.) is a JCS cache key limited to 256 chars long?   is there a way to increase its length?
> 2.) If can not get around the cache key length limitation, what could be the possible ways to make a long URL string short enough but still unique enough to serve as a key?  I tried to use the last 256 characters from the url string, but some query string is so long that it could not guarantee a key's uniqueness.

I guess the FileDiskCache is the issue here. The key of the item in
FileDiskCache is directly used as a file name. So what you experience is
a limit of file name length rather than key length.

You should better use another disk cache implementation such as
IndexedDiskCache which does not have such limits.

Bye, Thomas.

---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-users-unsubscribe@...
For additional commands, e-mail: jcs-users-help@...


Re: [JCS] Re: JCS Key Length Issue -- limited to 256 characters long?

by fox1964 :: Rate this Message:

| View Threaded | Show Only this Message

good point.   too focused on jcs     not realizing it is a file system issue.

--- On Thu, 1/5/12, Thomas Vandahl <tv@...> wrote:

From: Thomas Vandahl <tv@...>
Subject: [JCS] Re: JCS Key Length Issue -- limited to 256 characters long?
To: user@...
Cc: "JCS Users List" <jcs-users@...>
Date: Thursday, January 5, 2012, 4:48 AM

First of all: Please use user@... for questions regarding
JCS.

On 04.01.12 18:12, Chopin hu wrote:
> I have a program to download files from remote sites.   Once downloaded a data file, I use the URL as a key and put it to the cache so that I don't have to download it again if the url is found to exist in the cache.   However, I found sometimes the caching would fail -- no caching is put to the file system ( I am using Disk File Cache).   the url is working fine for downloading.   After debugging, it turns out that the URL string is too long.   When the url string exceeds 256 characters, JCS won't accept it as a proper key.   
>
> So my questions are:
> 1.) is a JCS cache key limited to 256 chars long?   is there a way to increase its length?
> 2.) If can not get around the cache key length limitation, what could be the possible ways to make a long URL string short enough but still unique enough to serve as a key?  I tried to use the last 256 characters from the url string, but some query string is so long that it could not guarantee a key's uniqueness.

I guess the FileDiskCache is the issue here. The key of the item in
FileDiskCache is directly used as a file name. So what you experience is
a limit of file name length rather than key length.

You should better use another disk cache implementation such as
IndexedDiskCache which does not have such limits.

Bye, Thomas.

---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-users-unsubscribe@...
For additional commands, e-mail: jcs-users-help@...