code: def _enable_lock(func):
      
  
      @functools.wraps(func)
      def wrapper(*args, **kwargs):
          self = args[0]
          if self.is_concurrent:
              only_read = kwargs.get('only_read')
              if only_read is None or only_read:
                  with self._rwlock:
                      return func(*args, **kwargs)
              else:
                  self._rwlock.acquire_writer()
                  try:
                      return func(*args, **kwargs)
                  finally:
                      self._rwlock.release()
          else:
              return func(*args, **kwargs)
  
      return wrapper
docs: The decorator for ensuring thread-safe when current cache instance is concurrent status.