Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
2 parents a5b8285 + 293a146 commit 13edc38
Show file tree
Hide file tree
Showing 65 changed files with 2,116 additions and 329 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/ci.yaml → .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ jobs:
with:
dotnet-version: "6.0.x"

- name: Verify README generation
uses: momentohq/standards-and-practices/github-actions/oss-readme-template@gh-actions-v1
with:
project_status: official
project_stability: experimental
project_type: sdk
sdk_language: .NET
usage_example_path: ./examples/MomentoApplication/Program.cs

- name: Commitlint and Other Shared Build Steps
uses: momentohq/standards-and-practices/github-actions/shared-build@gh-actions-v1
env:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ jobs:
uses: gerred/actions/current-time@master
id: current-time

- uses: actions/checkout@v2
- name: Setup repo
uses: actions/checkout@v2
with:
token: ${{ secrets.MOMENTO_MACHINE_USER_GITHUB_TOKEN }}

- uses: actions/setup-dotnet@v1
with:
Expand All @@ -36,3 +39,12 @@ jobs:
run: |
dotnet test tests/Integration/Momento.Sdk.Tests
shell: bash

- name: Generate README
uses: momentohq/standards-and-practices/github-actions/generate-and-commit-oss-readme@gh-actions-v1
with:
project_status: official
project_stability: experimental
project_type: sdk
sdk_language: .NET
usage_example_path: ./examples/MomentoApplication/Program.cs
8 changes: 2 additions & 6 deletions Momento.Sdk.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ VisualStudioVersion = 16.0.810.11
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Momento.Sdk", "src\Momento.Sdk\Momento.Sdk.csproj", "{188A76AD-422A-4829-B59F-9EC1C102EA38}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Momento.Sdk.Tests.Unit", "tests\Unit\Momento.Sdk.Tests\Momento.Sdk.Tests.csproj", "{77C34767-7796-4842-BE75-20563DB3230A}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Momento.Sdk.Tests.Unit", "tests\Unit\Momento.Sdk.Tests\Momento.Sdk.Tests.Unit.csproj", "{77C34767-7796-4842-BE75-20563DB3230A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Momento.Sdk.Tests.Integration", "tests\Integration\Momento.Sdk.Tests\Momento.Sdk.Tests.csproj", "{FB56314E-BDCF-474A-A2CD-8956934FF11B}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Momento.Sdk.Tests.Integration", "tests\Integration\Momento.Sdk.Tests\Momento.Sdk.Tests.Integration.csproj", "{FB56314E-BDCF-474A-A2CD-8956934FF11B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -27,10 +27,6 @@ Global
{FB56314E-BDCF-474A-A2CD-8956934FF11B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FB56314E-BDCF-474A-A2CD-8956934FF11B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FB56314E-BDCF-474A-A2CD-8956934FF11B}.Release|Any CPU.Build.0 = Release|Any CPU
{A0F6221C-42A9-454B-BB82-EDB9841DF6E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A0F6221C-42A9-454B-BB82-EDB9841DF6E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A0F6221C-42A9-454B-BB82-EDB9841DF6E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A0F6221C-42A9-454B-BB82-EDB9841DF6E1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
96 changes: 78 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,92 @@
# Momento client-sdk-csharp
<img src="https://docs.momentohq.com/img/logo.svg" alt="logo" width="400"/>

[![project status](https://momentohq.github.io/standards-and-practices/badges/project-status-official.svg)](https://github.com/momentohq/standards-and-practices/blob/main/docs/momento-on-github.md)
[![project stability](https://momentohq.github.io/standards-and-practices/badges/project-stability-experimental.svg)](https://github.com/momentohq/standards-and-practices/blob/main/docs/momento-on-github.md)

# Momento .NET Client Library


:warning: Experimental SDK :warning:

C# SDK for Momento is experimental and under active development.
There could be non-backward compatible changes or removal in the future.
Please be aware that you may need to update your source code with the current version of the SDK when its version gets upgraded.
This is an official Momento SDK, but the API is in an early experimental stage and subject to backward-incompatible
changes. For more info, click on the experimental badge above.

---

<br/>
.NET client SDK for Momento Serverless Cache: a fast, simple, pay-as-you-go caching solution without
any of the operational overhead required by traditional caching solutions!

C# SDK for Momento, a serverless cache that automatically scales without any of the operational overhead required by traditional caching solutions.

<br/>

## Getting Started :running:

### Requirements
1. brew install nuget
1. brew install --cask dotnet
1. [Visual Studio](https://visualstudio.microsoft.com/vs/mac/)
1. [.NET](https://docs.microsoft.com/en-us/dotnet/core/install/macos)

### How to run
1. dotnet build
- brew install nuget
- brew install --cask dotnet
- [Visual Studio](https://visualstudio.microsoft.com/vs/mac/)
- [.NET](https://docs.microsoft.com/en-us/dotnet/core/install/macos)

### Installation

```bash
dotnet add package Momento.Sdk
```

### Usage

Checkout our [examples](./examples/README.md) directory for complete examples of how to use the SDK.

Here is a quickstart you can use in your own project:

```csharp
using System;
using System.Threading.Tasks;
using Momento.Sdk;
using Momento.Sdk.Exceptions;
using Momento.Sdk.Responses;

namespace MomentoApplication
{
class Program
{
static readonly String MOMENTO_AUTH_TOKEN = Environment.GetEnvironmentVariable("MOMENTO_AUTH_TOKEN");
static readonly String CACHE_NAME = "cache";
static readonly String KEY = "MyKey";
static readonly String VALUE = "MyData";
static readonly uint DEFAULT_TTL_SECONDS = 60;

async static Task Main(string[] args)
{
using SimpleCacheClient client = new SimpleCacheClient(MOMENTO_AUTH_TOKEN, DEFAULT_TTL_SECONDS);
try
{
client.CreateCache(CACHE_NAME);
}
catch (AlreadyExistsException)
{
Console.WriteLine($"Cache with name {CACHE_NAME} already exists.\n");
}
Console.WriteLine("Listing caches:");
String token = null;
do
{
ListCachesResponse resp = client.ListCaches(token);
foreach (CacheInfo cacheInfo in resp.Caches)
{
Console.WriteLine(cacheInfo.Name);
}
token = resp.NextPageToken;
} while (!String.IsNullOrEmpty(token));
Console.WriteLine($"\nSetting key: {KEY} with value: {VALUE}");
await client.SetAsync(CACHE_NAME, KEY, VALUE);
Console.WriteLine($"\nGet value for key: {KEY}");
CacheGetResponse getResponse = await client.GetAsync(CACHE_NAME, KEY);
Console.WriteLine($"\nLookedup value: {getResponse.String()}, Stored value: {VALUE}");
}
}
}

### How to install
1. dotnet add package Momento.Sdk
```

### How to install (legacy version)
1. dotnet add package MomentoSdk -s https://momento.jfrog.io/artifactory/api/nuget/nuget-public
----------------------------------------------------------------------------------------
For more info, visit our website at [https://gomomento.com](https://gomomento.com)!
28 changes: 28 additions & 0 deletions README.template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{{ ossHeader }}

## Getting Started :running:

### Requirements

- brew install nuget
- brew install --cask dotnet
- [Visual Studio](https://visualstudio.microsoft.com/vs/mac/)
- [.NET](https://docs.microsoft.com/en-us/dotnet/core/install/macos)

### Installation

```bash
dotnet add package Momento.Sdk
```

### Usage

Checkout our [examples](./examples/README.md) directory for complete examples of how to use the SDK.

Here is a quickstart you can use in your own project:

```csharp
{{ usageExampleCode }}
```

{{ ossFooter }}
6 changes: 6 additions & 0 deletions examples/MomentoExamples.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MomentoApplication", "Momen
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "MomentoFSharpApplication", "MomentoFSharpApplication\MomentoFSharpApplication.fsproj", "{68EAA822-06A9-45CE-BCE0-9A1754F5450C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MomentoLoadGen", "MomentoLoadGen\MomentoLoadGen.csproj", "{307C0F57-D39C-461C-8F18-4E78DDD1BEFF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -21,6 +23,10 @@ Global
{68EAA822-06A9-45CE-BCE0-9A1754F5450C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{68EAA822-06A9-45CE-BCE0-9A1754F5450C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{68EAA822-06A9-45CE-BCE0-9A1754F5450C}.Release|Any CPU.Build.0 = Release|Any CPU
{307C0F57-D39C-461C-8F18-4E78DDD1BEFF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{307C0F57-D39C-461C-8F18-4E78DDD1BEFF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{307C0F57-D39C-461C-8F18-4E78DDD1BEFF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{307C0F57-D39C-461C-8F18-4E78DDD1BEFF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
28 changes: 28 additions & 0 deletions examples/MomentoLoadGen/MomentoLoadGen.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<LangVersion>latestmajor</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<LangVersion>latestmajor</LangVersion>
</PropertyGroup>
<ItemGroup>
<None Remove="Microsoft.Extensions.Logging" />
<None Remove="Microsoft.Extensions.Logging.Console" />
<None Remove="Momento.Sdk" />
<None Remove="HdrHistogram" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
<PackageReference Include="Momento.Sdk" Version="0.27.1" />
<PackageReference Include="HdrHistogram" Version="2.5.0" />
</ItemGroup>
</Project>
Loading

0 comments on commit 13edc38

Please sign in to comment.