On 04/24/2015 08:13 AM, George Neuner wrote:
I'm not using parameterize at all (at least not explicitly). I receive a web request that has up to 9 arguments contained in its bindings.


(define (search request)
  (let* [
         (params     (request-bindings request))
         (cookies    (request-cookies  request))

         (pid        (find-cookie "pid" cookies))
         (county     (exists-binding? 'county params))
         (state      (exists-binding? 'state  params))
         (search-txt (exists-binding? 'query  params))
         (search-and (exists-binding? 'all  params))
         (search-or  (exists-binding? 'any  params))
         (search-not (exists-binding? 'none params))
         (page-size  (exists-binding? 'page params))
         (sort       (exists-binding? 'sort params))
         :


Using those arguments, I retrieve information from the database regarding the client that issued the request and construct a complex database query. When that query succeeds, I need to enter additional accounting data for each result based on the client - but only for results that the client actually sees (paging), not necessarily for every result.

So I need to maintain a lot of state through a continuation: the open database connection [to cache the query results in the database], the current page that the client is looking at (for navigation), and ideally the client information for accounting [though I could look that up again if necessary].

George

My intuition is the more state you have, the better the continuation model serves you, as you don't have to pass and manage all that state explicitly through cookies, url params, etc. It sounds like you are not happy with the continuation model. You can of course use the "regular" web patterns in a racket web service, but you'll still have many of the same issues. Even in a non-continuation based service, you'll need some way of maintaining a client->database connection mapping, and find some way of removing stale db connections once the client is "gone", which you can never know for sure.

Are you trying to decide between using continuations and regular web state patterns?

Thanks,
Dave

--
You received this message because you are subscribed to the Google Groups "Racket 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to