Instances of RepositoryQuerySession are retained within the Repository 2nd-level cache named "webServicesQuerySessionSharedCache", which can be configured via the alfresco-global.properties file. By default, the cache allows up to 1000 objects to be cached. Cached objects are not cleared during GC, so it is important to correctly configure the cache sizes when using extremely little memory (1GiB max heap is extremely little for Alfresco).
Yes, some configuration operations are not supported for all Alfresco versions / editions. There also is a difference if the cache in question is created as a local-only or a cluster-distributed cache in Alfresco Enterprise. In 4.2, timeToLive and maxIdle weren't used for local caches.