Thanks Jeremy, that explain the behavior I'm observing!

I indeed expected "schema_cache" to apply to everything related to the 
relational database schema, not only the table `signature`s (let say). The 
fact is that my business logic systematically needs information about keys 
and indexes. I'll keep them in a cache myself!

Bernard





On Saturday, September 22, 2012 12:19:47 AM UTC+2, Jeremy Evans wrote:
>
> On Friday, September 21, 2012 7:04:05 AM UTC-7, blambeau wrote:
>>
>> Hi guys,
>>
>> I'm facing a little issue with Sequel in a Sinatra application (ran with 
>> thin).
>>
>> My logs show that a new database connection seems created and 
>> catalog-related queries sent for every request (so, no schema cache at 
>> all). I've checked that the same ::Sequel::Database instance is used for 
>> every request.
>>
>
> This isn't typical behavior, Database#schema does caching by default, 
> unless you set Database#cache_schema = false.
>
> Alternatively, if you are creating a new Database object every request, 
> your behavior is expected.  You should generally assign your Database 
> object to a constant so that doesn't occur.
>
> It is expected that Database#tables, Database#table_exists?, and 
> Database#indexes are not cached.  It's rare that those are called 
> repeatedly, you should do manual caching in your app in those cases.
>
> Jeremy
>

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sequel-talk/-/JI275IY2w6AJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to