• Facebook
  • 트위터
  • 유튜브
  • 라인드인
  • RSS
  • 기술 문서
  • 비교
  • 블로그
  • 다운로드
  • 문의하기
다운로드
목차 표시/숨기기

스프링 세션 사용

이 섹션에서는 통합 과정을 안내합니다. NCache 효율적이고 확장 가능한 Spring 세션 관리를 위해 Spring Boot 애플리케이션에 통합하세요. 이러한 세션은 일반 세션 또는 인덱싱된 세션일 수 있습니다. 인덱싱된 Spring 세션의 경우 인증된 사용자의 주체 이름이 저장됩니다. NCache 꼬리표.

사전 조건

  • 자바
<dependency>
    <groupId>com.alachisoft.ncache</groupId>
    <!--for NCache Enterprise-->
    <artifactId>ncache-spring-session</artifactId>
    <version>x.x.x</version>
</dependency>
  • Java 클라이언트 애플리케이션에서 다음 패키지를 가져옵니다.
    • import **클라이언트 이름**
    • import **런타임**을 위한 com.alachisoft.ncache.*;
    • import com.alachisoft.ncache.런타임.예외.*;
  • 캐시가 실행 중이어야 합니다.
  • 추가되는 데이터가 직렬화 가능.
  • 지원되는 Java 버전에 대한 자세한 내용은 다음을 참조하십시오. NCache 설치 가이드.
  • Spring Framework 버전은 6.0.12 이상.

스프링 세션 구현

Spring 세션을 연결하려면 애플리케이션에 어노테이션을 추가해야 합니다. NCache이렇게 하려면 메인 애플리케이션 클래스에 다음 어노테이션을 추가하십시오.

  • @SpringBootApplication // this is needed so that Spring can read the user created Beans and Configurations

또한 추가해야 할 사항도 있습니다. 한 구성을 추가하려면 다음 중 하나를 수행하세요.

  • @EnableNCacheHttpSession // uses the default configurations
  • @EnableNCacheHttpSession(cacheName = "demoCache")

하지만 인덱싱된 세션을 사용하려면 다음을 사용해야 합니다. @EnableNCacheIndexedHttpSession 위에서 언급한 설정을 사용하여 구성할 수 있는 주석 기능입니다.

사용자 지정 설정이 필요한 경우 어노테이션에 인수를 전달해야 합니다. 이러한 사용자 지정 설정은 쉼표로 구분됩니다. 예: cacheName="demoCache", namespace="randomNamespace"다음과 같은 사항을 포함할 수 있습니다.

  • cacheName -> default: demoCache
  • namespace -> default: "spring:sessions:"
  • maxInactiveInterval -> default: 1000 seconds
  • saveMode -> default: ON_SAVE
  • flushMode -> default: ON_SAVE

예를 들어, 세션을 사용하는 추측 게임이 있다면 다음과 같이 주석을 달 수 있습니다.

package com.alachisoft.ncache.guessgame;

import com.alachisoft.ncache.spring.sessions.config.annotation.web.http.EnableNCacheHttpSession;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
/*
    annotation to get access to NCache for session storage. Pass arguments in the annotation if you want custom settings. You can pass:
    1) cacheName -> default: demoCache
    2) namespace -> default: "spring:sessions:"
    3) maxInactiveInterval -> default: 1000 seconds
    4) saveMode -> default: ON_SAVE
    5) flushMode -> default: ON_SAVE
 */
@EnableNCacheHttpSession(cacheName = "spring")
public class GuessGameApplication {
    public static void main(String[] args) {
        SpringApplication.run(GuessGameApplication.class, args);
    }
}

도 참조

일반 Spring 캐싱 공급자에 대한 애플리케이션 구성
NCache 스프링 데이터 캐시로

문의하기

전화

+1 214-619-2601   (미국)

+44 20 7993 8327   (UK)

 
이메일

sales@alachisoft.com

support@alachisoft.com

NCache
  • 판 비교
  • NCache 아키텍처
  • 벤치 마크
다운로드
가격
놀이터를 사용해보십시오

배포
  • 클라우드(SaaS 및 소프트웨어)
  • 온 프레미스
  • Kubernetes
  • 도커
기술 사용 사례
  • ASP.NET 세션
  • ASP.NET 코어 세션
  • 게시/구독 메시징
  • 실시간 ASP.NET SignalR
  • 사물의 인터넷 IOT ()
  • NoSQL 데이터베이스
  • 스트림 처리
  • 마이크로 서비스
리소스
  • 잡지 기사
  • 제XNUMX자 기사
  • 기사
  • 비디오
  • 백서
  • 쇼
  • 회담
  • 블로그
  • 기술 문서
고객 사례 연구
  • 환자 후기
  • 고객
고객 지원
  • 데모 예약
  • 포럼(Google 그룹스)
  • Tips
회사
  • Leadership
  • 파트너
  • ​뉴스
  • 이벤트
  • 채용 정보
문의하기

  • 영어중국어 (간체)프랑스어독일 사람이탈리아 사람일본제한국어포르투갈어스페인어

  • 문의하기
  •  
  • 사이트 맵
  •  
  • 이용 약관
  •  
  • 개인정보 처리방침
© 저작권 Alachisoft 2002 - . 판권 소유. NCache 는 Diyatech Corp.의 등록상표입니다.
맨 위로