There is a potential of having more than one of these objects, and
they are not shared across users.  I've just implemented a cache.ram
solution, but I don't think I quite understand how the time_expire
works.

These objects are trees.  This is how I've implemented the cache.ram
solution:

def getTree( p ):
    return cache.ram( p['treeId'], lambda:None, time_expire = None )

def clearTreeCache( p ):
    cache.ram.clear( regex = p['treeId'] )

def storeTree( p ) :
    cache.ram( p['treeId'], lambda:p['tree'], None )

Is this a reasonable implementation ?

As for cPickle, I'm not sure what the problem is.  The reason I
believe is a file size problem is because I am able to pickle smaller
objects, whereas the exception is thrown when I attempt to  do it on a
larger object.  I'd be happy to copy the OSX exception dialogue if
that would help.  Also, I will try to pickle the object here :
os.path.join(request.folder,'private') and let you know what happens.
Thanks.

On Jul 27, 1:53 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
> If you have only one such objects, shared between all users than
> cache.ram may be a solution.
>
> I am surprised cPickle fails since the data is not so large. Are you
> sure it is a file size problem? Is it possible that the object simply
> contains unpicklable references?
>
> try store it on the filesystem in the
> os.path.join(request.folder,'private') folder.
>
> > 937984 Bytes is the size of the file when I pickle a large object to a
> > file.  This is protocol 0.  When I attempted to use protocol 2, it
> > failed.
>
> > I recently realized that the session itself is pickled, so I tried to
> > simply add the object to the session to see what would happen.  Same
> > result.
>
> > I'm dealing with large hierarchical data and would prefer to keep the
> > data in the session.  However, it looks like this might not be
> > feasible for large amounts of data.  What about increasing the memory
> > block for web2py?
>
> > I'm thinking my other option would be to keep it in cache.ram and in
> > the database.  What do you think?
>
> > On Jul 22, 5:37 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > How big is the pickled file?
>
> > > On Jul 22, 5:08 pm, "topher.baron" <topher.ba...@gmail.com> wrote:
>
> > > > web2py community,
>
> > > > I'm currently implementing a web application on localhost running OS
> > > > 10.6.4.  When I cPickle.dump a large object to the /tmp directory,
> > > > web2py crashes.  The same operations work with smaller objects.
>
> > > > Does this mean I need to increase the heap?  If so, how do I do this?
> > > > If not, any suggestions?
>
> > > > Thanks in advance.

Reply via email to