{"id":14283,"date":"2023-04-11T12:39:02","date_gmt":"2023-04-11T19:39:02","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=14283"},"modified":"2025-06-13T20:19:09","modified_gmt":"2025-06-14T03:19:09","slug":"extending-dotnet-caching-provider-collections","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/pt\/extending-dotnet-caching-provider-collections\/","title":{"rendered":"Extens\u00e3o do provedor de cache do .NET para cole\u00e7\u00f5es"},"content":{"rendered":"<p><span style=\"font-weight: 400\">Para ajudar os desenvolvedores de .NET a usar melhor o Couchbase em seus aplicativos, h\u00e1 uma cole\u00e7\u00e3o de aplicativos compat\u00edveis com a comunidade <\/span><a href=\"https:\/\/github.com\/couchbaselabs\/Couchbase.Extensions\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400\">Extens\u00f5es do Couchbase<\/span><\/a><span style=\"font-weight: 400\">. Isso inclui extens\u00f5es para cache, sess\u00e3o, multiop, compacta\u00e7\u00e3o e bloqueio. E h\u00e1 algumas extens\u00f5es oficialmente suportadas para <a href=\"https:\/\/www.couchbase.com\/blog\/pt\/dependency-injection-aspnet-couchbase\/\">inje\u00e7\u00e3o de depend\u00eancia<\/a>, telemetria aberta e transa\u00e7\u00f5es.<\/span><\/p>\n<p><span style=\"font-weight: 400\">A principal extens\u00e3o a ser discutida hoje \u00e9 <\/span><b>Couchbase.Extensions.Caching<\/b><span style=\"font-weight: 400\">que implementa o <\/span><a href=\"https:\/\/learn.microsoft.com\/en-us\/aspnet\/core\/performance\/caching\/distributed?view=aspnetcore-7.0\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400\">Interface do cache distribu\u00eddo do .NET<\/span><\/a><span style=\"font-weight: 400\"> usando o Couchbase. Isso pode ser adicionado ao seu projeto com <\/span><a href=\"https:\/\/www.nuget.org\/packages\/Couchbase.Extensions.Caching\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400\">NuGet<\/span><\/a><span style=\"font-weight: 400\"> (<\/span><em><span style=\"font-weight: 400\">dotnet add package Couchbase.Extensions.Caching<\/span><\/em><span style=\"font-weight: 400\">).<\/span><\/p>\n<p><span style=\"font-weight: 400\">Recentemente, trabalhei com um cliente do setor de cruzeiros que est\u00e1 gerenciando v\u00e1rios aplicativos e deseja armazenar dados de cache separadamente para cada aplicativo. No entanto, criar um bucket totalmente novo para cada aplicativo \u00e9 um exagero. Eles estavam se perguntando como especificar um escopo\/cole\u00e7\u00e3o ao usar o <em>Couchbase.Extensions.Caching<\/em> biblioteca.<\/span><\/p>\n<h2>Extens\u00f5es de sess\u00e3o e de cache<\/h2>\n<p><span style=\"font-weight: 400\">Nos \u00faltimos anos, a mudan\u00e7a do Couchbase SDK 2 para o SDK 3 introduziu muitos novos recursos e aprimoramentos, incluindo <\/span><a href=\"https:\/\/www.couchbase.com\/blog\/pt\/couchbase-server-7-0-release\/\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400\">Suporte a escopos\/cole\u00e7\u00f5es<\/span><\/a><span style=\"font-weight: 400\">. O <em>Couchbase.Extensions<\/em> A fam\u00edlia tamb\u00e9m foi atualizada para oferecer suporte ao SDK 3.<\/span><\/p>\n<p><span style=\"font-weight: 400\">No entanto, o <\/span><b>padr\u00e3o<\/b><span style=\"font-weight: 400\"> O uso dessa biblioteca usa o <\/span><em><span style=\"font-weight: 400\">Padr\u00e3o<\/span><\/em><span style=\"font-weight: 400\"> escopo e <\/span><em><span style=\"font-weight: 400\">Padr\u00e3o<\/span><\/em><span style=\"font-weight: 400\"> sem nenhuma op\u00e7\u00e3o integrada para especificar qualquer outra coisa.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Para ver isso em a\u00e7\u00e3o, aqui est\u00e1 a linha de configura\u00e7\u00e3o para adicionar o Couchbase como um cache distribu\u00eddo (extra\u00eddo do arquivo <\/span><a href=\"https:\/\/github.com\/couchbaselabs\/Couchbase.Extensions\/tree\/master\/example\/Couchbase.Extensions.Caching.Example\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400\">Projeto de exemplo do GitHub<\/span><\/a><span style=\"font-weight: 400\">):<\/span><\/p>\n<pre class=\"nums:false lang:c# decode:true\">builder.Services.AddDistributedCouchbaseCache(\"myproject\", opt =&gt; { });<\/pre>\n<p><span style=\"font-weight: 400\">Nesse c\u00f3digo, <em>meu projeto<\/em>\u00a0\u00e9 um nome de bucket. O <\/span><em><span style=\"font-weight: 400\">optar<\/span><\/em><span style=\"font-weight: 400\"> n\u00e3o tem uma op\u00e7\u00e3o para o nome do escopo\/cole\u00e7\u00e3o.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Usando o projeto de amostra, voc\u00ea ter\u00e1 informa\u00e7\u00f5es em cache como estas:<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-14284\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/extending-asp-net-caching-couchbase1.png\" alt=\"\" width=\"722\" height=\"246\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/04\/extending-asp-net-caching-couchbase1.png 722w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/04\/extending-asp-net-caching-couchbase1-300x102.png 300w\" sizes=\"auto, (max-width: 722px) 100vw, 722px\" \/><\/p>\n<p><span style=\"font-weight: 400\">(Observe que os nomes do bucket, do escopo e da cole\u00e7\u00e3o s\u00e3o <em>meu projeto<\/em>, <em>Padr\u00e3o<\/em>e <em>Padr\u00e3o<\/em>).<\/span><\/p>\n<h2>Extens\u00e3o da extens\u00e3o<\/h2>\n<p><span style=\"font-weight: 400\">Felizmente, a biblioteca \u00e9 extens\u00edvel o suficiente para que, com um pouco de c\u00f3digo, ela possa ser apontada para qualquer cole\u00e7\u00e3o que voc\u00ea queira.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Vamos examinar um pouco mais a fundo o projeto, especificamente <em>ICouchbaseCacheCollectionProvider.cs<\/em> e <em>DefaultCouchbaseCacheCollectionProvider.cs<\/em><\/span><\/p>\n<ul>\n<li style=\"list-style-type: none\">\n<ul>\n<li style=\"font-weight: 400\"><em><span style=\"font-weight: 400\">ICouchbaseCacheCollectionProvider<\/span><\/em><span style=\"font-weight: 400\"> cont\u00e9m um m\u00e9todo, <\/span><em><span style=\"font-weight: 400\">GetCollectionAsync<\/span><\/em><span style=\"font-weight: 400\">.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\"><em>A fun\u00e7\u00e3o<\/em> implementa esse m\u00e9todo com: <em>return bucket.DefaultCollection();<\/em><\/span><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">Mas e se voc\u00ea n\u00e3o quiser usar a cole\u00e7\u00e3o padr\u00e3o?<\/span><\/p>\n<p><span style=\"font-weight: 400\">Nesse caso, crie uma implementa\u00e7\u00e3o personalizada de <\/span><em><span style=\"font-weight: 400\">ICouchbaseCacheCollectionProvider<\/span><\/em><span style=\"font-weight: 400\">. Vou ligar para o meu <\/span><em><span style=\"font-weight: 400\">Provedor CustomCouchbaseCacheCollection<\/span><\/em><span style=\"font-weight: 400\">:<\/span><\/p>\n<pre class=\"nums:false lang:c# decode:true\">using Couchbase.KeyValue;\r\nnamespace Couchbase.Extensions.Caching.Example.Caching;\r\n\r\npublic class CustomCouchbaseCacheCollectionProvider : ICouchbaseCacheCollectionProvider\r\n{\r\n\u00a0 \u00a0 private readonly ICouchbaseCacheBucketProvider _bucketProvider;\r\n\u00a0 \u00a0 private readonly string _scopeName;\r\n\u00a0 \u00a0 private readonly string _collectionName;\r\n\r\n\u00a0 \u00a0 public CustomCouchbaseCacheCollectionProvider(ICouchbaseCacheBucketProvider bucketProvider, string scopeName, string collectionName)\r\n\u00a0 \u00a0 {\r\n\u00a0 \u00a0 \u00a0 \u00a0 _bucketProvider = bucketProvider;\r\n\u00a0 \u00a0 \u00a0 \u00a0 _scopeName = scopeName;\r\n\u00a0 \u00a0 \u00a0 \u00a0 _collectionName = collectionName;\r\n\u00a0 \u00a0 }\r\n\r\n\u00a0 \u00a0 public async ValueTask&lt;ICouchbaseCollection&gt; GetCollectionAsync()\r\n\u00a0 \u00a0 {\r\n\u00a0 \u00a0 \u00a0 \u00a0 var bucket = await _bucketProvider.GetBucketAsync().ConfigureAwait(false);\r\n\u00a0 \u00a0 \u00a0 \u00a0 var scope = await bucket.ScopeAsync(_scopeName);\r\n\u00a0 \u00a0 \u00a0 \u00a0 return await scope.CollectionAsync(_collectionName);\r\n\u00a0 \u00a0 }\r\n}<\/pre>\n<p><span style=\"font-weight: 400\">Considere isso como um ponto de partida. Em sua implementa\u00e7\u00e3o, voc\u00ea pode configur\u00e1-lo como quiser, adicionar l\u00f3gica adicional, etc.<\/span><\/p>\n<p><span style=\"font-weight: 400\">A pr\u00f3xima etapa \u00e9 adicionar isso como um servi\u00e7o (em <em>Program.cs<\/em> normalmente), especificando os nomes de escopo\/cole\u00e7\u00e3o:<\/span><\/p>\n<pre class=\"nums:false lang:c# decode:true\">builder.Services.AddSingleton&lt;ICouchbaseCacheCollectionProvider&gt;(x =&gt;\r\n\u00a0 \u00a0 new CustomCouchbaseCacheCollectionProvider(\r\n\u00a0 \u00a0 \u00a0 \u00a0 x.GetRequiredService&lt;ICouchbaseCacheBucketProvider&gt;(),\r\n\u00a0 \u00a0 \u00a0 \u00a0 \"mycachingscope\",\r\n\u00a0 \u00a0 \u00a0 \u00a0 \"mycachingcollection\"));<\/pre>\n<p><span style=\"font-weight: 400\">Se voc\u00ea estiver preocupado com o fato de isso ser substitu\u00eddo pelo provedor padr\u00e3o, observe que <\/span><em><span style=\"font-weight: 400\">TryAddSingleton<\/span><\/em><span style=\"font-weight: 400\"> \u00e9 <a href=\"https:\/\/github.com\/couchbaselabs\/Couchbase.Extensions\/blob\/master\/src\/Couchbase.Extensions.Caching\/CouchbaseCacheServiceCollectionExtensions.cs#L30\" target=\"_blank\" rel=\"noopener\">usado dentro de<\/a>\u00a0<\/span><em><span style=\"font-weight: 400\">AddDistributedCouchbaseCache<\/span><\/em><span style=\"font-weight: 400\">. Isso significa que <\/span><b>n\u00e3o vai<\/b><span style=\"font-weight: 400\"> substitua seu provedor personalizado pelo provedor padr\u00e3o.<\/span><\/p>\n<h2>Provedor personalizado em a\u00e7\u00e3o<\/h2>\n<p><span style=\"font-weight: 400\">Essa extens\u00e3o n\u00e3o criar\u00e1 de fato o escopo e a cole\u00e7\u00e3o especificados, portanto, certifique-se de que voc\u00ea os tenha criado com anteced\u00eancia.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Execute o aplicativo e experimente a API de previs\u00e3o do tempo com a p\u00e1gina interativa OpenAPI. A primeira vez que executar o ponto de extremidade resultar\u00e1 em uma \"falha de cache\", e nesse ponto os dados da previs\u00e3o do tempo ser\u00e3o gravados na cole\u00e7\u00e3o especificada:<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-14285\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/extending-asp-net-caching-with-collections.png\" alt=\"\" width=\"621\" height=\"263\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/04\/extending-asp-net-caching-with-collections.png 621w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/04\/extending-asp-net-caching-with-collections-300x127.png 300w\" sizes=\"auto, (max-width: 621px) 100vw, 621px\" \/><\/p>\n<p><span style=\"font-weight: 400\">(Observe que os nomes do bucket, do escopo e da cole\u00e7\u00e3o s\u00e3o <em>meu projeto<\/em>, <em>mycachingscope<\/em>e <em>mycachingcollection<\/em>).<\/span><\/p>\n<h2>Resumo<\/h2>\n<p><span style=\"font-weight: 400\">Com uma implementa\u00e7\u00e3o personalizada de uma interface e uma linha extra no <\/span><em><span style=\"font-weight: 400\">Program.cs<\/span><\/em><span style=\"font-weight: 400\">Se voc\u00ea quiser armazenar dados em cache, poder\u00e1 especificar o escopo\/cole\u00e7\u00e3o em que deseja armazen\u00e1-los.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Al\u00e9m disso, o <\/span><b>Couchbase.Extensions.Session<\/b><span style=\"font-weight: 400\"> usa a extens\u00e3o de cache como o mecanismo de armazenamento subjacente.<\/span><\/p>\n<ul>\n<li style=\"list-style-type: none\">\n<ul>\n<li><span style=\"font-weight: 400\">Feliz cache! <\/span><a href=\"https:\/\/github.com\/couchbaselabs\/blog-source-code\/tree\/master\/Groves\/142ExtendingAspNetCaching\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400\">O c\u00f3digo-fonte est\u00e1 dispon\u00edvel no GitHub<\/span><\/a><span style=\"font-weight: 400\">.<\/span><\/li>\n<li><span style=\"font-weight: 400\">Para obter mais informa\u00e7\u00f5es sobre o .NET, consulte o <\/span><a href=\"https:\/\/www.couchbase.com\/blog\/pt\/forums\/c\/net-sdk\/6\/\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400\">F\u00f3rum do Couchbase .NET<\/span><\/a><span style=\"font-weight: 400\"> e <\/span><a href=\"https:\/\/docs.couchbase.com\/dotnet-sdk\/current\/hello-world\/start-using-sdk.html\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400\">Documenta\u00e7\u00e3o do SDK do .NET<\/span><\/a><span style=\"font-weight: 400\">.<\/span><\/li>\n<li><span style=\"font-weight: 400\">Se voc\u00ea tiver d\u00favidas sobre cache, sess\u00e3o ou arquitetura em geral, consulte a se\u00e7\u00e3o <\/span><a href=\"https:\/\/www.couchbase.com\/blog\/pt\/developers\/community\/\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400\">Disc\u00f3rdia do Couchbase<\/span><\/a><span style=\"font-weight: 400\">.<\/span><\/li>\n<\/ul>\n<\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>To help .NET developers better use Couchbase in their applications, there is a collection of community-supported Couchbase Extensions. These include extensions for caching, session, multiop, compression, and locking. And there are some officially supported extensions for dependency injection, open telemetry, [&hellip;]<\/p>","protected":false},"author":71,"featured_media":14286,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1811,1814,9417,9336,2201],"tags":[2052,2024],"ppma_author":[8937],"class_list":["post-14283","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dotnet","category-application-design","category-performance","category-scopes-and-collections","category-tools-sdks","tag-extensions","tag-session"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.1 (Yoast SEO v26.1.1) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Extending .NET Caching Provider for Collections<\/title>\n<meta name=\"description\" content=\"With a custom implementation of an interface, and one extra line in your code, you can specify custom scope\/collections for storing data.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.couchbase.com\/blog\/pt\/extending-dotnet-caching-provider-collections\/\" \/>\n<meta property=\"og:locale\" content=\"pt_BR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Extending .NET Caching Provider for Collections\" \/>\n<meta property=\"og:description\" content=\"With a custom implementation of an interface, and one extra line in your code, you can specify custom scope\/collections for storing data.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/pt\/extending-dotnet-caching-provider-collections\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2023-04-11T19:39:02+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-14T03:19:09+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/04\/extending-dotnet-provider-collections.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Matthew Groves\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@mgroves\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Matthew Groves\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/extending-dotnet-caching-provider-collections\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/extending-dotnet-caching-provider-collections\/\"},\"author\":{\"name\":\"Matthew Groves\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/3929663e372020321b0152dc4fa65a58\"},\"headline\":\"Extending .NET Caching Provider for Collections\",\"datePublished\":\"2023-04-11T19:39:02+00:00\",\"dateModified\":\"2025-06-14T03:19:09+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/extending-dotnet-caching-provider-collections\/\"},\"wordCount\":576,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/extending-dotnet-caching-provider-collections\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/04\/extending-dotnet-provider-collections.png\",\"keywords\":[\"extensions\",\"session\"],\"articleSection\":[\".NET\",\"Application Design\",\"High Performance\",\"Scopes and Collections\",\"Tools &amp; SDKs\"],\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/extending-dotnet-caching-provider-collections\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/extending-dotnet-caching-provider-collections\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/extending-dotnet-caching-provider-collections\/\",\"name\":\"Extending .NET Caching Provider for Collections\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/extending-dotnet-caching-provider-collections\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/extending-dotnet-caching-provider-collections\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/04\/extending-dotnet-provider-collections.png\",\"datePublished\":\"2023-04-11T19:39:02+00:00\",\"dateModified\":\"2025-06-14T03:19:09+00:00\",\"description\":\"With a custom implementation of an interface, and one extra line in your code, you can specify custom scope\/collections for storing data.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/extending-dotnet-caching-provider-collections\/#breadcrumb\"},\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/extending-dotnet-caching-provider-collections\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/extending-dotnet-caching-provider-collections\/#primaryimage\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/04\/extending-dotnet-provider-collections.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/04\/extending-dotnet-provider-collections.png\",\"width\":1200,\"height\":628},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/extending-dotnet-caching-provider-collections\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Extending .NET Caching Provider for Collections\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"name\":\"The Couchbase Blog\",\"description\":\"Couchbase, the NoSQL Database\",\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"pt-BR\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"width\":218,\"height\":34,\"caption\":\"The Couchbase Blog\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/3929663e372020321b0152dc4fa65a58\",\"name\":\"Matthew Groves\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/ba51e6aacc53995c323a634e4502ef54\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/70feb1b28a099ad0112b8d21fe1e81e1a4524beed3e20b7f107d5370e85a07ab?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/70feb1b28a099ad0112b8d21fe1e81e1a4524beed3e20b7f107d5370e85a07ab?s=96&d=mm&r=g\",\"caption\":\"Matthew Groves\"},\"description\":\"Matthew D. Groves is a guy who loves to code. It doesn't matter if it's C#, jQuery, or PHP: he'll submit pull requests for anything. He has been coding professionally ever since he wrote a QuickBASIC point-of-sale app for his parent's pizza shop back in the 90s. He currently works as a Senior Product Marketing Manager for Couchbase. His free time is spent with his family, watching the Reds, and getting involved in the developer community. He is the author of AOP in .NET, Pro Microservices in .NET, a Pluralsight author, and a Microsoft MVP.\",\"sameAs\":[\"https:\/\/crosscuttingconcerns.com\",\"https:\/\/x.com\/mgroves\"],\"url\":\"https:\/\/www.couchbase.com\/blog\/pt\/author\/matthew-groves\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Extens\u00e3o do provedor de cache do .NET para cole\u00e7\u00f5es","description":"Com uma implementa\u00e7\u00e3o personalizada de uma interface e uma linha extra em seu c\u00f3digo, voc\u00ea pode especificar escopos\/cole\u00e7\u00f5es personalizados para armazenar dados.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.couchbase.com\/blog\/pt\/extending-dotnet-caching-provider-collections\/","og_locale":"pt_BR","og_type":"article","og_title":"Extending .NET Caching Provider for Collections","og_description":"With a custom implementation of an interface, and one extra line in your code, you can specify custom scope\/collections for storing data.","og_url":"https:\/\/www.couchbase.com\/blog\/pt\/extending-dotnet-caching-provider-collections\/","og_site_name":"The Couchbase Blog","article_published_time":"2023-04-11T19:39:02+00:00","article_modified_time":"2025-06-14T03:19:09+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/04\/extending-dotnet-provider-collections.png","type":"image\/png"}],"author":"Matthew Groves","twitter_card":"summary_large_image","twitter_creator":"@mgroves","twitter_misc":{"Written by":"Matthew Groves","Est. reading time":"3 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/extending-dotnet-caching-provider-collections\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/extending-dotnet-caching-provider-collections\/"},"author":{"name":"Matthew Groves","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/3929663e372020321b0152dc4fa65a58"},"headline":"Extending .NET Caching Provider for Collections","datePublished":"2023-04-11T19:39:02+00:00","dateModified":"2025-06-14T03:19:09+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/extending-dotnet-caching-provider-collections\/"},"wordCount":576,"commentCount":0,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/extending-dotnet-caching-provider-collections\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/04\/extending-dotnet-provider-collections.png","keywords":["extensions","session"],"articleSection":[".NET","Application Design","High Performance","Scopes and Collections","Tools &amp; SDKs"],"inLanguage":"pt-BR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/extending-dotnet-caching-provider-collections\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/extending-dotnet-caching-provider-collections\/","url":"https:\/\/www.couchbase.com\/blog\/extending-dotnet-caching-provider-collections\/","name":"Extens\u00e3o do provedor de cache do .NET para cole\u00e7\u00f5es","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/extending-dotnet-caching-provider-collections\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/extending-dotnet-caching-provider-collections\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/04\/extending-dotnet-provider-collections.png","datePublished":"2023-04-11T19:39:02+00:00","dateModified":"2025-06-14T03:19:09+00:00","description":"Com uma implementa\u00e7\u00e3o personalizada de uma interface e uma linha extra em seu c\u00f3digo, voc\u00ea pode especificar escopos\/cole\u00e7\u00f5es personalizados para armazenar dados.","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/extending-dotnet-caching-provider-collections\/#breadcrumb"},"inLanguage":"pt-BR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/extending-dotnet-caching-provider-collections\/"]}]},{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/www.couchbase.com\/blog\/extending-dotnet-caching-provider-collections\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/04\/extending-dotnet-provider-collections.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/04\/extending-dotnet-provider-collections.png","width":1200,"height":628},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/extending-dotnet-caching-provider-collections\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Extending .NET Caching Provider for Collections"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"Blog do Couchbase","description":"Couchbase, o banco de dados NoSQL","publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"pt-BR"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"Blog do Couchbase","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","width":218,"height":34,"caption":"The Couchbase Blog"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/3929663e372020321b0152dc4fa65a58","name":"Matthew Groves","image":{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/ba51e6aacc53995c323a634e4502ef54","url":"https:\/\/secure.gravatar.com\/avatar\/70feb1b28a099ad0112b8d21fe1e81e1a4524beed3e20b7f107d5370e85a07ab?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/70feb1b28a099ad0112b8d21fe1e81e1a4524beed3e20b7f107d5370e85a07ab?s=96&d=mm&r=g","caption":"Matthew Groves"},"description":"Matthew D. Groves \u00e9 um cara que adora programar. N\u00e3o importa se \u00e9 C#, jQuery ou PHP: ele enviar\u00e1 solicita\u00e7\u00f5es de pull para qualquer coisa. Ele tem programado profissionalmente desde que escreveu um aplicativo de ponto de venda QuickBASIC para a pizzaria de seus pais nos anos 90. Atualmente, ele trabalha como gerente s\u00eanior de marketing de produtos da Couchbase. Seu tempo livre \u00e9 passado com a fam\u00edlia, assistindo aos Reds e participando da comunidade de desenvolvedores. Ele \u00e9 autor de AOP in .NET, Pro Microservices in .NET, autor da Pluralsight e Microsoft MVP.","sameAs":["https:\/\/crosscuttingconcerns.com","https:\/\/x.com\/mgroves"],"url":"https:\/\/www.couchbase.com\/blog\/pt\/author\/matthew-groves\/"}]}},"authors":[{"term_id":8937,"user_id":71,"is_guest":0,"slug":"matthew-groves","display_name":"Matthew Groves","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/70feb1b28a099ad0112b8d21fe1e81e1a4524beed3e20b7f107d5370e85a07ab?s=96&d=mm&r=g","author_category":"","last_name":"Groves","first_name":"Matthew","job_title":"","user_url":"https:\/\/crosscuttingconcerns.com","description":"Matthew D. Groves \u00e9 um cara que adora programar.  N\u00e3o importa se \u00e9 C#, jQuery ou PHP: ele enviar\u00e1 solicita\u00e7\u00f5es de pull para qualquer coisa.  Ele tem programado profissionalmente desde que escreveu um aplicativo de ponto de venda QuickBASIC para a pizzaria de seus pais nos anos 90.  Atualmente, ele trabalha como gerente s\u00eanior de marketing de produtos da Couchbase. Seu tempo livre \u00e9 passado com a fam\u00edlia, assistindo aos Reds e participando da comunidade de desenvolvedores.  Ele \u00e9 autor de AOP in .NET, Pro Microservices in .NET, autor da Pluralsight e Microsoft MVP."}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/posts\/14283","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/users\/71"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/comments?post=14283"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/posts\/14283\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/media\/14286"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/media?parent=14283"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/categories?post=14283"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/tags?post=14283"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/ppma_author?post=14283"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}