session_cache.py
Go to the documentation of this file.
1 # Copyright 2018 gRPC authors.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 """gRPC's APIs for TLS Session Resumption support"""
15 
16 from grpc._cython import cygrpc as _cygrpc
17 
18 
19 def ssl_session_cache_lru(capacity):
20  """Creates an SSLSessionCache with LRU replacement policy
21 
22  Args:
23  capacity: Size of the cache
24 
25  Returns:
26  An SSLSessionCache with LRU replacement policy that can be passed as a value for
27  the grpc.ssl_session_cache option to a grpc.Channel. SSL session caches are used
28  to store session tickets, which clients can present to resume previous TLS sessions
29  with a server.
30  """
31  return SSLSessionCache(_cygrpc.SSLSessionCacheLRU(capacity))
32 
33 
34 class SSLSessionCache(object):
35  """An encapsulation of a session cache used for TLS session resumption.
36 
37  Instances of this class can be passed to a Channel as values for the
38  grpc.ssl_session_cache option
39  """
40 
41  def __init__(self, cache):
42  self._cache = cache
43 
44  def __int__(self):
45  return int(self._cache)
grpc::experimental.session_cache.SSLSessionCache._cache
_cache
Definition: session_cache.py:42
grpc::experimental.session_cache.ssl_session_cache_lru
def ssl_session_cache_lru(capacity)
Definition: session_cache.py:19
xds_interop_client.int
int
Definition: xds_interop_client.py:113
grpc::experimental.session_cache.SSLSessionCache.__int__
def __int__(self)
Definition: session_cache.py:44
grpc::experimental.session_cache.SSLSessionCache
Definition: session_cache.py:34
grpc._cython
Definition: src/python/grpcio/grpc/_cython/__init__.py:1
grpc::experimental.session_cache.SSLSessionCache.__init__
def __init__(self, cache)
Definition: session_cache.py:41


grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:01:18