# Sharing in-mem cache

**URL:** <https://forum.heroiclabs.com/t/sharing-in-mem-cache/2252>\
**Category:** Runtime Framework\
**Created:** [January 11, 2022, 7:06am UTC](https://forum.heroiclabs.com/t/sharing-in-mem-cache/2252 "2022-01-11T07:06:21Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![tunglt1810](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/tunglt1810/32/924_2.png) [@tunglt1810](https://forum.heroiclabs.com/u/tunglt1810)\
**Post date:** [January 11, 2022, 7:06am UTC](https://forum.heroiclabs.com/t/sharing-in-mem-cache/2252/1 "2022-01-11T07:06:21Z")

</div>

Hi guys,

I am trying to make a logic to prevent that player can join multiple match.

I can create a in-mem cache for dev only, and redis cache for scaling. But are there any practial solution with runtime framework supportation ?

---

<div class="post-metadata">

**Author:** ![mofirouz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/mofirouz/32/1523_2.png) [@mofirouz](https://forum.heroiclabs.com/u/mofirouz)\
**Post date:** [January 11, 2022, 9:13am UTC](https://forum.heroiclabs.com/t/sharing-in-mem-cache/2252/2 "2022-01-11T09:13:18Z")

</div>

You don’t need to cache anything, there is a configuration option in Nakama that prevents multiple socket connection from a user, or multiple match joins from a user:

> **[Configuration - Heroic Labs Documentation](https://heroiclabs.com/docs/nakama/getting-started/configuration/#session)**
>
> Documentation for the Nakama realtime and social server for games and apps.

---

<div class="post-metadata">

**Author:** ![tunglt1810](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/tunglt1810/32/924_2.png) [@tunglt1810](https://forum.heroiclabs.com/u/tunglt1810)\
**Post date:** [January 11, 2022, 9:46am UTC](https://forum.heroiclabs.com/t/sharing-in-mem-cache/2252/3 "2022-01-11T09:46:35Z")

</div>

Thank you @mofirouz

I miss that segment on this document. If i have two modules of match are A and B. When a player P is joining match A and try to join match B, what does the behavior of system

- Kick P from A and let’s him join B after that
- Or only kick if P try to join another match of A

---

<div class="post-metadata">

**Author:** ![mofirouz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/mofirouz/32/1523_2.png) [@mofirouz](https://forum.heroiclabs.com/u/mofirouz)\
**Post date:** [January 11, 2022, 9:58am UTC](https://forum.heroiclabs.com/t/sharing-in-mem-cache/2252/4 "2022-01-11T09:58:08Z")

</div>

Nakama doesn’t differentiate between different match handlers in this regards - it will not allow you to join a second match as long as you are part of a (any) match.

---

<div class="post-metadata">

**Author:** ![tunglt1810](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/tunglt1810/32/924_2.png) [@tunglt1810](https://forum.heroiclabs.com/u/tunglt1810)\
**Post date:** [January 11, 2022, 10:17am UTC](https://forum.heroiclabs.com/t/sharing-in-mem-cache/2252/5 "2022-01-11T10:17:11Z")

</div>

Ya, it makes sense.

Do you think the scenario of joining multiple matches but having only one for each model is a good feature to have?

---

<div class="post-metadata">

**Author:** ![novabyte](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/novabyte/32/1324_2.png) [@novabyte](https://forum.heroiclabs.com/u/novabyte)\
**Post date:** [January 11, 2022, 11:40am UTC](https://forum.heroiclabs.com/t/sharing-in-mem-cache/2252/6 "2022-01-11T11:40:47Z")

</div>

@tunglt1810 Can you give an example of when a user would be legitimately concurrently active in more than one match handler which represents different multiplayer game types?

---

<div class="post-metadata">

**Author:** ![tunglt1810](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/tunglt1810/32/924_2.png) [@tunglt1810](https://forum.heroiclabs.com/u/tunglt1810)\
**Post date:** [January 12, 2022, 7:40am UTC](https://forum.heroiclabs.com/t/sharing-in-mem-cache/2252/7 "2022-01-12T07:40:12Z")

</div>

I have a “Lobby” match and i dont want player join some lobby in the same time. And I also want to create some minimatch as a popup in-game like tic-tac-toe, rock-paper-scissor…
